How to recognize the native "back" button of the android device in an application.

1

I would like to know how do I detect in an application that the user clicked the "Back" button native to the device. Well, I need to take action if that happens.

    
asked by anonymous 15.09.2016 / 23:01

1 answer

4

Using the method:

@Override
public void onBackPressed() {
   //aqui você controla o voltar fisico do aparelho
}
    
15.09.2016 / 23:02