Android :: Action Before StartActivity
Jul 22, 2010
I'm new in Android development and I've a problem when I create my new activity.I want to use my activity before start it. For example, But, my "menu" and "MyActivity.class" aren't the same instance.
View 2 Replies
Nov 3, 2010
I want to show some notification when android phone is connected to system. I implemented BroadcastReceiver for listening to event android.intent.action.ACTION_UMS_CONNECTED in my application But it is not working. Is it possible to capture this event.
View 3 Replies
View Related
Oct 31, 2010
I thought that Action was preeminent during intent resolution and if the intent had the same action as the intent filter, it would be considered a match regardless of data, if the filter did not specify anything. So I was very surprised to find that supplying action+data where filter had only action, causes it to fail. In the code below, if you comment out line 47 so that data is *not* sent, only then it resolves correctly. To get it to work with the data (an id that is simply a String), what mime type should I specify in the intent filter?
View 11 Replies
View Related
Apr 7, 2009
My use case is to launch one of settings app screen when I receive a certain event in idle state. For which, I added my new intent to PhoneAppBroadcastReceiver() in PhoneApp.java (looks like this receiver handles the misc intents) But when i call startActivity(), The phone seems to go into a panic ex. startActivity(new Intent(this, NetworkSetting.class)); My questions are is this the right approach to go about ? If so 1. How can I launch the activity inside of broadcastReceiver? secondly 2. How do i verify if the activity i want to start is already started?Can the NEW_TASK_LAUNCH be used to verify this ,
View 2 Replies
View Related
Nov 23, 2009
I have splitted my Android project in 2 packages, lets say: test.current and test.another. From an activity in test.current I want to start an activity in the package test.another
View 6 Replies
View Related
Jul 15, 2010
Why should I use startActivity() in a Service? If I need an Activity a have to call an activity and if I need a "delayed activity" I have to use the notification. So, why should I use startActivity()?
View 1 Replies
View Related
Jun 29, 2009
According to the doc, if the intent in startActivity(intent) is not found, there will be an exception raised. Therefore I use a try/catch block. However, even if I use a random string as the intent, the promised exception does not occur.Instead I see a dialog that says: "No application can perform this function". I also get the same dialog if the intent is valid (picked up by an app) but apparently doesn't want to act when the extras are not what the app expects (e.g. my earlier question about Intent.ACTION_SEND and mime types). I am using the 1.5_r2 SDK on an AVD running 1.5, with the app running at version 1.1 (sdk=2). Is this a doc error, a bug or am I misunderstanding something? Can I simply delete the try/catch block?
View 3 Replies
View Related
May 15, 2009
I have a Activity and I have a class which extends this Activity. In this subclass I call:
startActivity(new Intent(this, CameraView.class))
Which should start the "CameraView" Activity. However, I always get this error:
CODE:...........
If it makes any difference the subclass creates a ListView and when a row of the ListView is clicked it calls startActivity();
View 5 Replies
View Related
Dec 7, 2009
I have a TabActivity subclass that attempts to start a new activity via a menu item selection in onOptionsItemSelected.I am receiving the following exception which eludes me at the moment.I'm not sure why it thinks I am *not* in an activity!
View 2 Replies
View Related
Apr 7, 2009
I'd like to launch one of settings app screen when I received a certain event in idle state. For that, I added my new intent to PhoneAppBroadcastReceiver() in PhoneApp.java (because it seems this receiver handles the misc intents) But if I called startActivity(), seems phone goes to panic. ex. startActivity(new Intent(this, NetworkSetting.class));
1. How can I launch the activity inside of bradcastreceiver?
2. If the activity which I want to start is already started, how can I check it? I read can use NEW_TASK_LAUNCH but don't know how to use it. If you have a sample code, could you post it?
View 3 Replies
View Related
Mar 3, 2009
what is the scenario that makes me to pick between startActivity and startSubActivity
View 2 Replies
View Related
Apr 20, 2009
What's the correct way to pass a bundle to the activity that is being launched from the current one? Shared properties?
View 2 Replies
View Related
Sep 28, 2010
Is there any event triggered on an activity when I call startActivity("activity_id", myIntent);
If the Activity exists already. I pass a parameter to the activity via i.putExtra("someID", someSerializableObject ); and would like to call a method to refresh a WebView. Right now, the call on startActivity brings the activity in the foreground but the webview does not display what i want.
View 1 Replies
View Related
Nov 24, 2010
I have one subclass which extends Dialog class, it seems I can not use startActivity() function to start a new Activity in this subclass which extends Dialog class, how to resolve it?
How to start a new Activity in a Dialog subclass? (In my customized dialog subclass, I have one button, when pressed, I would like to have a new Activity start).
View 3 Replies
View Related
Sep 2, 2009
I meet an issue: my activity cannot return result.
I created an activity which has one TabHost. I added three tabs using mTabHost.addTab. Every tab will launch an activity(activity A, activity B, activity C). In activity A, it will call startActivityForResult to start activity A1. The issue is activity A cannot get any result after A1 finish.
What is the reason? How should I do if I want to get return value?
View 3 Replies
View Related
Aug 10, 2010
I have a main activity and a sub activity.The main activity starts the sub activity using startActivity, and passes an object in the intent.The sub activity reads the object out of the intent in its onCreate action.The sub activity updates the object, then returns to the main activity using startActivity, again passing the updated object back.However, the main activities onCreate function is not called, so the code it contains to read the passed object does not run.Further investigation indicated that the main activity onPause event is firing, i.e. it is only paused when the sub activity runs, so when the sub activity starts the main activity again, it just on Resumes.Does anyone know if there would be any disadvantages if I moved my data restore/store activities to the onResume and onPause events?I'm not using the onCreate saved Instance State, should I be?
View 4 Replies
View Related
Sep 11, 2010
I'm using an AlarmManager to trigger an intent that broadcasts a signal. The following is my code:
CODE:................
I'm calling this code from an activity, so I don't know how I could be getting the following error...
CODE:....................
Is this really what you want?
View 1 Replies
View Related
Oct 12, 2010
I have implemented a ListView in my Android application.
I bind to this ListView using a custom subclass of the ArrayAdapter class. Inside the overridden ArrayAdapter.getView(...) method, I assign an OnClickListener. In the onClick(View v) method of the OnClickListener, I want to launch a new activity.
I get the exception:
Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
How can I get the context that the ListView (the current Activity) is working under?
View 2 Replies
View Related
Aug 17, 2010
I'm struggling to understand why startActivity runs properly when copied from a tutorial I found and fails when I make the smallest change.
Code from the tutorial:
CODE:........
That works. When I try to change it to what I would consider a simpler design, I am getting an error.
CODE:........
The error is: The constructor Intent(FirstTwoApps.ButtonHandler, Class) is undefined
Notice that all I did was moved the action from the handleButtonClick() method to the onClick() method. Apparently that is not allowed, but I don't understand why.
View 2 Replies
View Related
Jun 9, 2010
I have a problem about taskAffinity of Activity. Activities A and B with the same taskAffinity.
A starts B with FLAG_ACTIVITY_NEW_TASK and the B starts A with FLAG_ACTIVITY_NEW_TASK again. Dumpsys activity of system gives us task stack like below: TOP-> A B A
According to SDK's reference to FLAG_ACTIVITY_NEW_TASK, the result is supposed to be like below: TOP -> A B
If we did not set taskAffinity, A will not be created again but in different task stack from B. (A and B are in different Apps)
After a little more research, we found FLAG_ACTIVITY_REORDER_TO_FRONT is what we want.
My question is whether SDK' reference to FLAG_ACTIVITY_NEW_TASK is wrong?
View 8 Replies
View Related
Oct 15, 2009
I have an Activity X which is only accessible after you've entered a valid credential.
How can I prevent other apps from calling startActivity with an Intent pointing to X?
e.g. Intent intent = new Intent( this, ActivityX.class );
startActivity( intent );
Basically I don't want Activity X to be exported to any apps except my app.
View 1 Replies
View Related
Sep 27, 2010
When ever we need to send an email in Android we will invoke registered email application using Intent.ACTION_SEND. like the below
Intent i = new Intent(Intent.ACTION_SEND);
startActivity(Intent.createChooser(i, "Send mail..."));
My doubt is why do we need to use Intent.createChooser in startActivity rather than using
startActivty(i).
Is there any specific reason of using Intent.createChooser()?
View 1 Replies
View Related
Mar 31, 2010
I would like to display a an access dialog activity at the start of my application.
In other words, I would like to start another activity (in dialog theme) as soon as my Main Activity is loaded. But, I know that I can not start an activity while another is creating.
I tried to start this activity in the onResume() method : I can see the new activity called, but the Main activity do not respond after closing the new activity.
Is there a solution to do this, without using delayed intent ? May i use a special flag for my intent ? I did not find, in the activity cycle, a way to detect the end of activity loading.
View 6 Replies
View Related
Jul 2, 2010
I've got an app that creates an intent for the last.fm android app in which it will start the "recommended" station for my account when i press a button. The trick i'm trying to figure out is how do i get the phone back to my app without the user having to navigate back manually? Once it start the last.fm intent it takes you to the playlist and i need it to resume back to my app automatically.
View 2 Replies
View Related
Aug 10, 2010
MyService and MyClient are both running, although MyClient is currently in the background. If MyService sends an Intent to MyClient via:
CODE:..............
How do I get this Intent in MyClient? Running this code triggers onResume() in MyClient, but because it's already running, calling getIntent() returns the Intent that initially created MyClient, which is always android.intent.action.MAIN
View 2 Replies
View Related
Jan 27, 2010
I am running into a critical conflict of sorts. My app is a remote service which essentially starts an activity when the screen goes to sleep. How it does this is very simple via screen off broadcast receiver and then an explicit intent to start the activity as a new task. The activity is basically in charge of responding to key events and displaying some simple text.
Thanks to a few window flags added in 2.0, activities can do this. They can be created in a way that either puts them on top of the lockscreen, or completely dismiss the lockscreen. This way they basically have focus without the lockscreen having to be dismissed by user. The alarm clock in 2.0 uses the flags to wake up the device and show the alarm dialog. I use them to place my activity when the screen sleeps so the user sees a custom wakeup lockscreen. The reason we create it at screen off is to get rid of lag the user experiences at wakeup involving first seeing the lockscreen, then seeing the activity appear. Also doing it immediately at sleep allows it to have focus so it can handle key events effectively.
The process works perfectly except in certain apps. So far, it seems the bug is consistent while browser (and even dolphin browser) as well as the facebook app are running. The bug never happens in GTalk or Launcher. It is rare but can still be duplicated in the messaging app every so often. I can't figure out why my activity doesn't get created at sleep while these apps are active. My remote service still gets the screen off broadcast and does the startActivity for the explicit intent, and that's all I get in the log. My onCreate is not being called. Instead it gets called when we wake the screen up again.
I have tried, as a control, to hold the partial wakelock starting when my remote service gets created, and the issue persists. So I don't believe it is a problem that the CPU has gone to sleep. Since only these particular apps cause the issue to duplicate, I can't imagine why the activity start fails. What could those apps be doing to interfere with another app's ability to get created? I use singleInstance as the launch mode so that I can ensure that the activity will never be able to be recalled by user process. I want it to go away when user unlocks and it is working fine like this, as long as it is able to be created. The singleInstance ensures I can have the same lockscreen handle an intent to do something specific based on user actions that the remote service monitors.
my source code can be viewed on my project page. http://code.google.com/p/mylockforandroid/source/browse/#svn/trunk/myLock/src/i4nc4mp/myLock
The issue happens to both my CustomLockService and NoLockService variations. These two services will start Lockscreen or ShowWhenLockedActivity and the bug is witnessed. The build illustrating the bug's end result-- user has to try to unlock 3 times due to the bug because on wakeup when the oncreate finally succeeds, user is seeing the activity when normally it would have auto-dismissed thanks to key event logic that also isn't seeming to happen due to the delayed onCreate, so they have to send it to sleep again. Now that the activity is properly done being started, and screen is asleep, the expected functionality happens at next wakeup-- can be downloaded also from the downloads tab.
This seems like an extremely irrational thing to be caused only by specific apps. I am quite baffled and out of ideas for a solution unless I've made some critical mistake in my activity definitions.
View 1 Replies
View Related
Sep 13, 2010
I am having two activities, say activity A and B. Activity A is an ListActivity, and when the items in the list is selected, it will call startActivity() to bring up B. The problem here is that when I am in B and click the home key, and then go to the application launcher to resume my application, A will be brought up again. This time when I click a different item in A, it will bring up B with the old data of the previously selected item before the home key was clicked.
After examinzing the code, I found that the startActivity does not update the intent of B. I found a post here about the similar question, and the answer was to overwrite the onNewIntent. However, I found that it doesn't work, because this method never get called when the second time I call startActivity. I am sure that this is the same instance, because I've printed out the instance number. Is there any other ways to update the intent of the activity? Or I need some other settings to make the onNewIntent get called? I didn't set any flags or launch modes, so everything is default.
View 1 Replies
View Related
Sep 21, 2010
I tried to create a edittextbox, and button next to it, in the status bar.! I created it and tried to launch the browser activity, when somebody enters a URL in the textbox & click that button.
I get runtime exception as below.Can anyone please help what is the issue with this exception ? I know that Status bar is not a seperate activity. It is part of 'PhoneWindow'.
CODE:.............................
View 7 Replies
View Related
Mar 4, 2012
Code:
package com.danielholst.soundmixer;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class LoadingSplashScreen extends Activity {
/** Called when the activity is first created. */
[Code] ...
xml here
Code:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<activity
android:name=".LoadingSplashScreen"
[Code] ......
View 1 Replies
View Related
Apr 5, 2012
I am developing an application in order to connect to Google Navigator by the following code..
public static void Call_GoogleMapsNavigation(int longitud,int latitud)
import android.app.Activity;
import android.content.Context;
import android.content.Intent;[code].....
View 2 Replies
View Related