Custom translucent activity from notification

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

Custom translucent activity from notification

Postby czadek » Tue Feb 24, 2009 11:51 am

Hello,

how to show custom activity in my application when I click notification?

My app contains two activities (a1 and a2). a1 is MAIN activity and it shows when application starts. When application start it creates a service, this service creates notification. When I click notification after exit my app I want to be redirected to activity a2.

I use for that this code:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, a2.class), 0);
  2.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

It works almost perfect, besides that a2 is Translucent activity and in the background of this a2 activity I see a1 activity. How to display only a2 activity (something similar to popup window)?

Regards,
czadek
czadek
Freshman
Freshman
 
Posts: 3
Joined: Mon Feb 23, 2009 10:41 am

Top

Postby MrSnowflake » Tue Feb 24, 2009 12:17 pm

I think that when you open a new activity, all activities on the activity stack are displayed again, so when a2 starts you will see the previous last Activity that was open. Did you try opening a different task first?
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby czadek » Tue Feb 24, 2009 12:37 pm

Yes, i tried
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Intent i = new Intent(this, a2.class);
  2. i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  3. i.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
  4.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

Interesting is that, if I exit my app using BACK buton, activity a2 shows without a1 in the background. If I use HOME button a1 appears in the background.

Regards,
czadek
czadek
Freshman
Freshman
 
Posts: 3
Joined: Mon Feb 23, 2009 10:41 am

Postby czadek » Thu Feb 26, 2009 9:43 am

If user exit app using BACK button activity goes to onDestroy(), if user "exit" app using HOME button, app goes only to onStop().
So in onStop() method I set finish() and all seems to be ok.
This should always enforce application exit.

Regards,
czadek
czadek
Freshman
Freshman
 
Posts: 3
Joined: Mon Feb 23, 2009 10:41 am

Postby MrSnowflake » Thu Feb 26, 2009 4:07 pm

Yup, I think so.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests