Android :: Android - Start New Intent But No Parent Class
Jun 28, 2010
I've a ListActivity with a ListView, onItemClick I start an Intent. Oncreate of this Intent I make a getParent but it's null. if I do this.isChild() it's false.
mPostList.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
Intent IntentDiscution = new Intent(parent.getContext(), EcrireMessage.class);
....
IntentDiscution.putExtras(objetbunble);
parentClass.startActivity(IntentDiscution);
}
View 3 Replies
Aug 17, 2010
A Follow up to this question: http://stackoverflow.com/questions/3488880/group-of-views-controls-on-multiple-screens
I have created a parent class and a child class that inherits from it. When I set the OnClickListener in the child class, the event fires when the button is clicked. When I move the set OnClickListener to the parent class, the event doesn't fire. I've got to be missing something obvious but I just don't see it.
CODE:............
Child Class:
CODE:.........................
View 2 Replies
View Related
Oct 7, 2010
I wish to have a single class which all of my Activity classes extend. I have ListActivities, Activities, MapActivities, TabActivities, etc in my App.
I have many of these different activities in my app, ~12 activities. I want each of them to have the methods which are in the parent class.
Right now, i have created 4 parent activity classes which are extended from a certain activity depending on their type(ListActivity, Activity, MapActivity, TabActivity)
I am creating a lot of redundant code - each of the 4 parent activities has almost identical code, in exception for what class activity it extends.
Here is an example that may clarify what my problem is:
I have an Activity: MenuScreen which extends BaseListActivity BaseListActivity extends ListActivity BaseListActivity contains methods and fields which i want all my activities to have access to I have another Activity: HomeScreen which extends BaseActivity BaseActivity extends Activity BaseActivity contains the same methods and fields which are in my other Base[<type>]Activity classes(such as BaseListActivity)
These methods/fields are copy-pasted to all my Base[<type>]Activity, and seems awfully redundant to me.
Can i create a master activity class which all types of Activity classes can use as its parent? if not, am i stuck with copy and pasting this code and feeling gross/dirty about it?
View 2 Replies
View Related
May 12, 2009
As an exercise I attempted to add an AppWidgetProvider-derived class to one of our existing Android applications. When the widget is created and appears on the home screen, the output from adb logcat notes: W/ActivityManager(58): Unable to launch app com.mycompany.myapp/ 10042 for broadcast Intent { action=android.appwidget.action.APPWIDGET_ENABLED comp= {com.mycompany.myapp/com.mycompany.myapp.MyAppWidgetProvider} }: process is bad
This output comes from around line 10814 in ActivityManagerService (looking at cupcake on git). This is running on an ADP 1.5, FWIW. The same AppWidget code, once separated from the main application's project and put into its own simple project, runs as expected, so I know my manifest entries/XML/Java are all as they should be. Has anyone else run into this, or perhaps can the Android team comment on what aspect of my application might be preventing the AM from starting up the process when the widget is added to the home screen?
View 6 Replies
View Related
Oct 14, 2010
I have four groups in a listview each with four url's I want to load in a webView. When the user select a url to goto I set a value like so;
if (position == 0) webb = webb +2;
{
Intent intent = new Intent(this, official.class);
startActivity(intent);
}
I then carryout the intent to move to the webView class where I have given each URL a value like so;
if (webb == 2) mWebView.loadUrl("http://yahoo.com");
if (webb == 3) mWebView.loadUrl("http://www.bbc.co.uk");
But the screen stays blank, if I state the value inside the official.class it works. How can I get this value to pass to another class based on the selection the user makes from the listview.
View 3 Replies
View Related
Oct 16, 2010
I have been trying to get "getExtra" to work but without success, I have a listview with 4 choices which launch a webpage within a webView class, when the user selects the option lets say option 3 I want to pass the value of 3 to the webView class so that it will load the correct webpage, at the moment I get no errors, but the app force closes when I select the option, could this be due to having to announce this in the manifest? can somebody help with where I am going wrong. This is my intent
public void onListItemClick(ListView l, View v, int position, long id) {
if (position == 0) {
Intent intent = new Intent(this, official.class);
intent.putExtra("weburl", 3);
startActivity(intent);}
This is the official class:
public class official extends Activity {
int number = getIntent().getIntExtra("weburl", 0);
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
mWebView.goBack();
return true;
} return super.onKeyDown(keyCode, event);
} WebView mWebView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.browser1);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
if (number == 2) mWebView.loadUrl("http://bcafc.livewwware.co.uk");
if (number == 3) mWebView.loadUrl("http://www.bbc.co.uk");
mWebView.setWebViewClient(new HelloWebViewClient());
View 1 Replies
View Related
May 5, 2010
I had write two classes IntentA and IntentB in my application (Both are in same package and both extends Activity class). In IntentA class I had created one button on pressing that button controll is trsnfer to IntentB class. IntentB class also contain Button on pressing that control is transfer to IntentA class.
This work fines. Now I want to set value in IntentA class using putExtra method and access that value in IntentB class How should I do that? I had put value in class IntentA like
Intent i1 = new Intent(this,IntentB.class);
i1.putExtra("Intent Name", "IntentA");
startActivity(i1);
Now I don't know How to access "Intent Name" value in IntentB class.
View 5 Replies
View Related
Jan 2, 2010
I have three classes one main-activity(named MainMap), one non-activity class(named MyItemizedOverlay), and one activity class(named AudioStream). I want to start AudioStream activity from non-activity class but i don't know how to.
View 1 Replies
View Related
Jun 10, 2010
I am trying to set the class for an intent to the address listed in a string value, so that I can launch a given activity. The string is composed dynamically during runtime.
Is there anyway to make something like the code below run...
View 2 Replies
View Related
Jul 28, 2010
I've got two activities, one of them is called MyActivity. I want both of them to be able to use a function located in a class othat we may call MyClass. In MyClass, I try to use an intent to launch the activity AnotherActivity. Since the constructor takes a context as parameter, I simply tried to store a context from the activity in the constructor, and then use it when I try to create my intent.However, even thought none of the arguments are null (checked that with a simple if-statement), intent seems to be null and a NullPointerException is thrown. Why does it not work, and what can I do to solve the problem?
I'm quite new to Android and Java development, so please explain it as basic as you can.
View 2 Replies
View Related
Jul 20, 2010
I'm programming an android application using the StartActivityForResult() - Method.
But, i want to get as result an own class, not a string or something like that.
how can i tell the intent to use the class i wrote to give back?
View 2 Replies
View Related
Jun 29, 2010
I am calling intents alot in my program and I thought that I could write a public class that would have all of my intents so I can just call something like intents.testIntent(params) and then have it fire off the intent.
I tried it out but am getting a force close with a null pointer exception. This is my whole class. I know it is probably sloppy but I have just been learning java for 2 months so I still am an amateur. Any way, my code...
View 1 Replies
View Related
Jul 28, 2009
I was experimenting with extending the Intent class but don't seem to make it work properly. I am wondering if extending is even possible. Here is the snippets.
Code for custom intent: Code...
View 3 Replies
View Related
Sep 3, 2010
Can I pass a singleton class's object from one activity to another activity using intent? I am using singleton class as image class img = image class.get Instance();, so i need the img instance for another activity, how can i pass an object instance in Android.
View 2 Replies
View Related
Aug 18, 2010
I create an Intent in one class then it's returned to another class. I need to check the type of intent it is. I need to ensure it's not a specific class of intent.
View 1 Replies
View Related
May 8, 2009
I'm posting this to share the lessons I learned while working with IntentService. IntentService has a single constructor that takes a string argument "name". The documentation has no description of what name is used for. In looking at the sources, I found that its only use is in naming the worker thread for the IntentService. This thread is named IntentService [name].
I initially implemented the constructor of the derived class to also take a String argument and passed it along to the derived class. This is wrong. This will cause the startService() call to generated a java.lang.InstantiationException in the application containing the service i.e. you don't get the exception in the application calling startService(). A clue to the actual problem is a little further up in the logs:"newInstance failed: no <init>()"
The derived class must have a Default constructor and that constructor must call super() passing a string for the name component of the worker thread name.
public class MyIntentService extends IntentService {
public MyIntentService() { super("MyIntentService");
} @Override
protected void onHandleIntent(Intent intent) {
// Handle events on worker thread here }
View 2 Replies
View Related
Feb 24, 2009
I have two classes Screen1 and Screen2 both extends activity i have to pass data from the Screen1 to Screen 2
I wrote in onCreate method of Screen1 class
CODE:............
My doubt is ,how to receive myval data in Screen2 class ,what is the code i have to add in AndroidManifest.xml file
View 6 Replies
View Related
Jun 8, 2009
Can you please tell me how can I start an intent to launcher the IM application on android?
View 4 Replies
View Related
Feb 24, 2009
I would like to know, if i can register for an intent or a notification that i could get every time android starts an application.
View 2 Replies
View Related
Nov 18, 2010
This is vinod i have been saving problem while i am starting Activity in receiver so i would know this is the way or not for start activity in receiver
View 3 Replies
View Related
May 4, 2010
For example, I have an activity that uses a utility class. I would like to be able to start an activity from the utility class and have the activity result sent back to the utility class.
The only way I could think of starting the activity was to pass the original activity to the utility class, so that the utility class could use the original activity to start the activity. The problem with this is that the activity is sent to the original activity, rather than the utility class.
I also thought of actually making the utility class an activity itself, but that would make using the utility class much more complicated.
View 10 Replies
View Related
Mar 4, 2010
I had come across a code snippet which calls for an activity without referring to any context. Before, i was considering that context is used to tell about the calling component. But as i came see that another component can be called without any reference to context, it makes me wonder what purpose it might be serving. please put some light on it.
Here is the code which calls for an activity without referring to 'context'
CODE:............................
View 1 Replies
View Related
Jul 25, 2010
I want to specifically run the default Android browser for a given URL. I'm using this code: I also tried adding <uses-library android:name="com.google.android.browser" /> to the manifest. Am I missing something here? PS: I'm not interested in using startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"))) as it will list all the choices for the browsing Intent.
View 3 Replies
View Related
Oct 2, 2009
if the inner UpdateService class is not static, it cannot start the service. The ActivityManager complains "Unable to start service Intent"...
View 8 Replies
View Related
Aug 11, 2010
I've found a problem that may random FCs on some certain phones.
Here's the code snapshot:
CODE:.............
View 9 Replies
View Related
Jun 3, 2009
is it possible to start a call from the android browser, let's say by clicking a link in an html file or with javascript after a button click? maybe with help of the gears api? i'd appreciate any hints, maybe an example of how to embed the intent in the html-file/in javascript.
View 3 Replies
View Related
Nov 29, 2009
I'm trying to start an activity out of a widget so I can't use the startActivity() function. So I'm trying to create the correct intent but I don't find what I'm missing.
View 2 Replies
View Related
May 6, 2010
I know how to update my own programs, and I know how to open programs using the a predefined Uri (for sms or email for example)
I need to know how I can create an Intent to open MyTracks or any other application that I don't know what intents they listen to.
I got this info from DDMS, but I havn't been succesful in turning this to an Intent I can use. This is taken from when opening MyTracks manually.
CODE:..................
View 2 Replies
View Related
Feb 4, 2010
Is it possible to start an Intent but keep it hidden? For example now to start the intent I am using startActivitity(intent). Suppose the intent is to start a web browser, the webbrowser is shown to user. Is it possible to keep this hidden?
View 3 Replies
View Related
May 14, 2009
How can i open the contact view with a query?
I try this:
CODE:......
I get this error: android.content.ActivityNotFoundException: No Activity found to handle Intent { action=android.intent.action.SEARCH data=content://contacts/ people (has extras) }
Second Question: Is it possible to search also for address and telephone numbers? I have no problems in my own activity, it works fine. But i will start the device contact list search.
View 3 Replies
View Related