Hello friends, I want to implement a Home button in my Android App which will terminate the all the Activities but the first one. Instead of user pressing the Back button again and again, I want to give user a single button which will take him/her on the first (Home) Activity. Please help how to implement it.
+1
A:
I dont have the SDK on this laptop to be sure about the syntax, but i think this is it.
Set up a listener for the "home" button, in the onClick() method:
Intent i = new Intent(ActivityYouAreOnNow.this,firstActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
blindstuff
2010-10-25 03:35:22
Thank you buddy.
Mudassir
2010-10-25 03:51:58
+1
A:
Have a look here: http://stackoverflow.com/questions/2776830/android-moving-back-to-first-activity-on-button-click
SteD
2010-10-25 03:40:51