Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid notification bar open last active activity?
    primarykey
    data
    text
    <p>I am creating like timer application and when I start timer I have option to go to android Home or start any other activity .</p> <p>When I start timer I set a notification bar icon and if i use some other application (mean go from started timer activity) and now I need to go to back to my previously started timer activity by clicking on notification icon ???</p> <p>When I click I am starting a new instance timer activity , not the previously started timer activity ! , and if I then click back button it show me a previously timer activity ..</p> <p>Question is: How to call previously started activity trough notification bar , not to start new instance of that activity ??</p> <p>This is sample of my code below :</p> <pre><code>private void notificationBar() { String ns = Context.NOTIFICATION_SERVICE; NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns); int icon = R.drawable.ico; CharSequence tickerText = "some title..."; long when = System.currentTimeMillis(); Notification notification = new Notification(icon, tickerText, when); Context context = getApplicationContext(); CharSequence contentTitle = "some app title"; CharSequence contentText = "...some info !"; Intent notificationIntent = new Intent(this, main.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT | Notification.FLAG_AUTO_CANCEL); notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); mNotificationManager.notify(NOTIF_ID, notification); } private void notificationClose(int notifID) { String ns = Context.NOTIFICATION_SERVICE; NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns); mNotificationManager.cancel(notifID); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload