Current activity not returning to previous activity on close

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Current activity not returning to previous activity on close

Postby teradyl » Tue Dec 08, 2009 2:59 am

Hello,

I have a service that starts a new intent which is an activity(I'll call notificationActivity) created specifically to show a dialog box to alert the user.

Whenever notificationActivity gets started, my main UI activity also gets started immediately beforehand, resulting in the focus being on the main UI after closing the dialog box.

This is not the desired behavior, since I want the focus to be back on the activity I was previously on before the notificationActivity popped up, rather than now being in the main UI activity. (By the way, if anyone has a different approach to solve this problem, I'm all ears...I just don't like the way android handles it's official notification with a small icon appearing at the top.)

I think it's because my main UI activity is the MAIN action and has the LAUNCHER category, and that whenever the notificationActivity is started, android wants to pull up the main activity as well.

I tried to put some flags on the intent before I started it in the service, namely:
FLAG_ACTIVITY_NEW_TASK
FLAG_ACTIVITY_NO_HISTORY
FLAG_ACTIVITY_NO_USER_ACTION
but to no avail.

Some extra info:
The notification needs to be first created from the main UI. So, if I'm still in the main UI when the notification arrives, everything works as planned. If I press the home button to exit the main UI, it won't work and it'll reopen the main UI. However, if I press the back button to get out of the main UI, the functionality will work as desired and not open up the main UI. (Again, I think this is because it wants to have the MAIN activity open, and since it's already on the history stack it doesn't mind leaving it in the background...or something like that).

If you need anything else or some code, just ask.

Any help would be appreciated.
teradyl
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Dec 08, 2009 2:21 am
Location: Ann Arbor, MI

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests