Is the app originally launched from Eclipse?
If so, beware that Eclipse uses a different intent than would normally
be used by the Launcher(s), so you may get duplicates like this.
To get a good test, either don't launch from Eclipse, or first press
Back to close the initial activity, start a new one from Launcher, then
test your notifications.
Other than that, here is what I use for widgets / notifications.
It matches the intent used by Launcher(s), and so resumes an existing
activity if there is one:
Intent baseIntent = new Intent(context, **** ACTIVITY CLASS
HERE ****.class);
baseIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
baseIntent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
baseIntent.setAction(Intent.ACTION_MAIN);
baseIntent.addCategory(Intent.CATEGORY_LAUNCHER);
PendingIntent pendingIntent =
PendingIntent.getActivity(context, 0, baseIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
-- Kostya
On 02/02/2012 02:25 AM, leslie.karpati wrote:
Hi!
I'am writing an online radio streamer application. It's working very
well (activity->bind service->notificiation bar, ...etc), but
sometimes when I go back to the UI (ex.: click to the application icon
from the menu, when the service and the activity are already running -
onResume) it's start a new/second/duplicated activity, but the old
one does't killed. For example: when I press key back after that it's
destroy the new activity and going to back to the old one, and I can
kill it too.
I put this code to the onResume:
Log.v(TAG, "Activity onResume called. Context:"+context);
and onlye when the problem is occured (stared the second activity
above the old one), I got a different contex id.
Where is the problem?
Thanks,
Leslie
--
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en