I would like handle back button in my application i have used fragment class in whole application .So when i would like to come back to base activity,it throw out application,Please give me any suggestion.
Asked
Active
Viewed 213 times
-2
-
1take a look here: http://stackoverflow.com/questions/5448653/how-to-implement-onbackpressed-in-android-fragments – Bartek Filipowicz Feb 03 '14 at 13:10
2 Answers
-3
You just need to override the onBackPressed method on your activity.
@Override
public void onBackPressed() {
//Put your logic here :)
}

GhostDerfel
- 1,533
- 1
- 11
- 18
-3
I dont understand what you want to do, but if you want to implement your own code in the back button this is how you do it.
@Override
public void onBackPressed() {
// your code
}
If you do nothing, then nothing will happen on a back press.
Edit: perhaps the above is not at all what you want, I've some difficulties understanding you. However, if you properly want to understand activities and how they are managed / created this is a must read. http://developer.android.com/guide/components/tasks-and-back-stack.html

Johan
- 753
- 2
- 11
- 31