onBackPressed() closes two Activities

My Activity Stack looks like this MainActivity--> LibraryActivity--> ViewerActivity.

The problem is: when i pressing android button back in Viewer it closes, Library showes and closes at once. Screen goes to MainActivity

In ViewerActivity i have overriden method OnBackPressed :
public override void OnBackPressed()
{
SaveState(false); //custom function to save files;
base.OnBackPressed();
}

Best Answer

Answers

  • rzee7rzee7 INUniversity ✭✭✭✭✭

    Hi @something_awsm

    You mean to say when you click back button your application goes exit? Can you please share more details?

    Thanks
    RIYAZ

  • @rzee7, sorry for some mess.

    App should work like this: on ViewerActivity user press BackButton for returning to LibraryActivity. But instead, after pressing back appears LibraryActivity (unactive: components doesn't react) and in the moment closes and app opens MainActivity.

  • @SeanDavies.1435, thanks. That helped

Sign In or Register to comment.