Josh Russo Josh Russo - 1 year ago 81
Android Question

The appropriate way to leave an Android app? (Xamarin)

I'm developing an Android using Xamarin. The app has a login modal and I would like the behavior of the back button on the login modal to essentially exit the app, as if you were at the end of the navigation stack.

Is this possible?

Answer Source

If you are displaying the modal on android via a new Activity, override OnBackPressed in the modal activity like so:

public override void OnBackPressed()
            Intent intent = new Intent(Intent.ActionMain);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download