-3

I am try to finish activity.I have 5 activity in a Second activity i have list view and on clicking on item of list view 3rd activity is open without finishing activity. and the i come back and i click on button on 2nd activity and go to 5 activity an there is one button lo-gout. i click on that button and go to 1 activity. so o want to finish 1st activity. how can i do. please give me solution for this i try may things.

Rohit Goswami
  • 617
  • 5
  • 17
  • Not so clear...but if you want to clear other activity so call with flag Activity clear top.... – Rohit Goswami Feb 25 '15 at 12:06
  • 1
    possible duplicate of [Clear the entire history stack and start a new activity on Android](http://stackoverflow.com/questions/3473168/clear-the-entire-history-stack-and-start-a-new-activity-on-android) – Sufian Feb 25 '15 at 12:06

2 Answers2

2

In your AndroidManifest.xml in your Activity tags add the following :

android:noHistory="true"
J.Vassallo
  • 2,282
  • 3
  • 15
  • 14
0

simple:

  Intent intent = new Intent(context, FirstActivity.class);
  intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);

I'm using it on my app on the same use case, the Log out and the Delete account buttons are buried after 3 activities in the stack.

Budius
  • 39,391
  • 16
  • 102
  • 144