Search code examples
androidbuttonback

Android Back Button does not work ?


I'm newbie on android development. I try to develop an app to store user expenses on db and show it on another activity. When I press the back button on emulator, the app is shutting down.

I'm finishing the activity before the start intent? This could be a problem?


Solution

  • You should first start the new activity before finishing the current one.

    Intent i = net Intent(this.currentactivity, nextactivity.class);
    startActivity(i);
    finish();