CopyPastor

Detecting plagiarism made easy.

Score: 0.9399902326089364; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2013-05-22
by Sandeep

Original Post

Original - Posted on 2011-04-26
by jakebasile



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Try adding [`FLAG_ACTIVITY_NEW_TASK`][1] as described in the docs for [`FLAG_ACTIVITY_CLEAR_TOP`][2]:
> This launch mode can also be used to > good effect in conjunction with > FLAG_ACTIVITY_NEW_TASK: if used to > start the root activity of a task, it > will bring any currently running > instance of that task to the > foreground, and then clear it to its > root state. This is especially useful, > for example, when launching an > activity from the notification > manager.


Intent intent = new Intent(this, TabActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);



[1]: http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NEW_TASK [2]: http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_TOP
Try adding [`FLAG_ACTIVITY_NEW_TASK`][1] as described in the docs for [`FLAG_ACTIVITY_CLEAR_TOP`][2]:
> This launch mode can also be used to > good effect in conjunction with > FLAG_ACTIVITY_NEW_TASK: if used to > start the root activity of a task, it > will bring any currently running > instance of that task to the > foreground, and then clear it to its > root state. This is especially useful, > for example, when launching an > activity from the notification > manager.
So your code to launch `A` would be:
Intent intent = new Intent(this, A.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); CurrentActivity.this.finish(); // if the activity running has it's own context

// view.getContext().finish() for fragments etc.




[1]: http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NEW_TASK [2]: http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_TOP

        
Present in both answers; Present only in the new answer; Present only in the old answer;