Currently I use an Activity
which finishes immediately, thus pulling the last Activity
from the app stack.
public class ViewlessActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
finish();
}
}
Is there any better solution?
UPDATE:
I followed the recommendation from David but couldn't make it working like required (it is always showing the MainActivity)
Here the code which creates the pending intent:
Intent mainActivityIntent = new Intent(this.getApplicationContext(), MainActivity.class);
mainActivityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pendingMainActivityIntent = PendingIntent.getActivity(this.getApplicationContext(), 0, mainActivityIntent, PendingIntent.FLAG_CANCEL_CURRENT);
Aucun commentaire:
Enregistrer un commentaire