-2

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.

Angel
  • 902
  • 8
  • 16

2 Answers2

-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