The default behavior of an activity when BACK softkey is pressed is, GO BACK TO PREVIOUS ACTIVITY. If some the same activity is waiting for some response from server or some data updation is going on and then press BACK, I want to wait on the same screen till the current task is completely processed and then move out to the previous activity.

You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe@googlegroups.com For more options

My app is comprised of a set of reusable Activities that other apps can reuse. For various reasons, I would like my Activities to be launched in context of the invoking Activity's process, instead of always being launched in my Activity's process (default behavior on Android). How can I achieve this?

The default behavior from my observation is if current activity force closes Android tries to go to previous activity on stack How can I control this behavior? I want force close to close all activities

I used Toast to make notification, but it seems it will appear even its activity is not in the current screen and some other activity has been started.I want to check this situation, when the activity is not the current one, I'd not send the Toast notification. But how to do ?

I have following problem with my application: From my main activity ("activity 1"), there is a menu from which user can launch an action. This action will result in an Intent being received by a BroadcastReceiver, defined in my application. Finally, this BroadcastReceiver will start an activity ("activity 2") to deal with this intent.

The problem is that I have a "quit application" entry in my menu, and I can only finish() currently active activity. ie I am not able to finish "activity 1" from the menu of "activity 2". And I can't use startActivityForResult() as "activity 2" can't be started from "activity 1". Any suggestion would be much appreciated Thank you very much guys, regards.

Is it possible to add an activity on top of the current activity.For example lets say i click a button, and then it adds a second activity to the current activity. And the second activity only covers a small place at the bottom of my current activity.

I am running a CM11 nightly of KitKat 4.4.1 on a VZW Note II, however I have had this issue with other devices, carriers, Android versions, etc. so I have always assumed it is just the way Android works.

Basically if an app that is currently using the camera (Camera app, barcode scanner, etc) crashes or hangs and gets force-closed, opening any camera app after that seems to always give me either a "can't connect to camera" error or a black screen instead of the viewfinder. In these cases, a simple reboot fixes the issue and I can use the camera again, but this is inconvenient for two reasons:

1. A reboot on my phone takes 45-60 seconds, by which time whatever I wanted a picture of is usually gone or changed.

2. Rebooting means that any apps that don't save the data constantly but run in the background are restarted and I lose the progress. Mainly I am referring to Chrome incognito tabs, but also apps that don't save in-progress data such as puzzle games or video players.

With my limited knowledge of Linux and my slightly less limited knowledge of operating systems in general, I know that sometimes a temporary lock file is Created to prevent other apps/programs from modifying or accessing a file or program until the lock is released. Does that kind of situation apply here, such as a camera lock file being created when camera access is started and then not able to be released if the app crashes.? Also, if that does apply, would manually deleting the lock file or creating a script that does it for me when it is run allow access to the camera again without rebooting? And if that doesn't apply, is there any way to regain camera access without rebooting when this occurs?

How can I know what Activity has started the current Activity? Is there any specific method like, i.e. getIntent().getCallerActivity() or the only way is saving some information within the Intent using putExtra()?

I am trying to make a task switcher and i succed in it. My only problem is that when I launch activities, they are relaunched as they were new activities ( for instance, I am writing an email, i press home and go into my activity,launch email, and then the app launch the email bout goes back at the inbox and the email is lost) So that's not true multitasking.

I have a TabActivity class A with 2 tabs, a sub activity class B in tab 2.

Now a dialog pops up from the UI in B, once i click the save button in this dialog it goes back to the TabActivity but the tab is set to 1, however i want to set the current tab to 2 once the dialog box closed.

In short i need to acquire the tabHost reference in the diaglo when clicking on the save button.

I have been looking for this for a while but I can't find any way of doing it. A contrived example would be a service that simply displays the name of the current running activity as an Ongoing Notification. For instance, when the user is reading a particular email, the name of the activity (hopefully the email title!) would appear in the notifications window and when the user switches to read a text message, the notification would change to show the name of the new activity. Is there a way to do this in Android?

I am trying to save some values in the onSaveInstanceState(Bundle) method of my activty by following the example here: How do I save an Android application's state?

But it doesnt seem to load it from the Oncreate(). the bundle object is always null but whenever i call another activity, it does indeed go into the onSaveInstanceState method to save my values.

Now i read that question i just posted and someone noted how they could not get it to work in an emulator? unfortunately that is all im working on. On an emulator and cant test the app on the device as i have no device available to me right now And the web services i am interacting with are in a local VM on my work machine that cannot be accesses remotely at the moment.

My question is, is it true that saved bundles dont work on emulators? I also noticed how when i do dismiss or bring up a new activity , the activity calles onPause and then onStop. when i bring back the same activty, it goes straight to onCreate?

now according to the docs here http://developer.android.com/guide/topics/fundamentals.html#actlife That is correct in terms of what the lifecycle diagram shows but if you read below that diagram on the onStop() section it says the next step it goes into is either onRestart() or onDestroy()? no mention of onCreate? Type on the docs?

Anyways here is my onSaveInstanceState() and onCreate() both in the same activity: code...

In current activity, when user click the back key, I don't what it back to the last activity. Can I add a listener to listen to back key in current activity? When user click "back" key, it actually back to the activity I want it to go.

I have an NoContentViewActivity which has no Content View (i.e. I did not call setContentView() in the onCreate of my Activity).

My question is how can I keep the content view of the launching activity on the screen? Right now, I am getting a blank screen whenever I launch NoContentViewActivity? I want the content view of the launching activity (the activity which start the NoContentViewActivity) to show on the screen.

What I am trying to do is emulating the "Home" button which takes one back to Android's homescreen. So here is what causes me problems: I have 3 launcher activities. The first one (which is connected to the homescreen icon) is just a (password protected) configuration activity. It will not be used by the user (just admin) One of the other 2 (both accessed via an app widget) is a questionnaire app. I'm allowing to jump back between questions via the Back button or a GUI back button as well. When the questionnaire is finished I sum up the answers given and provide a "Finish" button which should take the user back to the home screen.

For the questionnaire app I use a single activity (called ItemActivity) which calls itself (is that recursion as well when using intents?) to jump from one question to another:

The final screen shows something like "Thank you for participating" as well as the formerly described button which should take one back to the homescreen. But I don't really get how to exit the Activity properly. I've e.g. used this.finish(); but this strangely brings up the "Thank you" screen again. So how can I just exit by jumping back to the homescreen?

I have a very simple android project. I got the following error message when I try to run it. The emulator is running but the application doesn't come up. I couldn't find any useful information online.