In my app when activity goes to status onPause I trigger its notifications through the NotificationManager. I'd like it to be retrieved into the onResume state if a click was given in the notification. Through this code I can open a new activity, but what I intended was to recover the activity that is in the onPause state:
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
PendingIntent p = PendingIntent.getActivity(MainActivity.this, 0, new Intent(MainActivity.this, MainActivity.class), 0);
NotificationCompat.Builder builder = new NotificationCompat.Builder(MainActivity.this);
builder.setTicker("Tiker Valor: "+Integer.toString(i));
builder.setContentTitle("Titulo Valor: "+Integer.toString(i));
builder.setContentText("Descrição");
builder.setSmallIcon(R.drawable.ic_launcher);
builder.setContentIntent(p);
Notification n = builder.build();
n.flags = Notification.FLAG_AUTO_CANCEL;// Retira a notificação quando esta for clicada
nm.notify(R.drawable.ic_launcher, n);