Home > Enterprise >  How to put an exit icon that close the app in the main screen?
How to put an exit icon that close the app in the main screen?

Time:07-12

The title is the question right here, but to be more specific, i'll show the example. Exit icon as i want to do.

CodePudding user response:

Execute the following lines of code in your icon's OnClickListener,

MainActivity.this.finish();
System.exit(0);

CodePudding user response:

You can use the following code to terminate an application via a click event in Xamarin Forms.

For more details, you can refer to this thread.

  private void Button_Clicked(object sender, EventArgs e)
        {
            System.Diagnostics.Process.GetCurrentProcess().Kill();
        }

  • Related