I am working with Xmarine c# anroid app. Here I am unable to close the app on back button pressed. In my app on the landing activity (Activity1) we will get 3 buttons, each button will open a new activity (inner1,inner2,inner3). Now if we click back button from any of these 3 inner activity then it will come to the landing activity (Activity1).It is working fine. Now if we click back button from (Activity1) the app does not close and every time it repoens the landing activity.
Where as I need to close the app at the time of back button press of (Activity1). How to close app on back button press.
Here I have used the below mentioned code for performing closing activity from Activity1 back pressed.
Process.KillProcess(Process.MyPid());
Also I have used the below mentioned code for redirecting the Landing activity from all inner1, inner2, inner3 activity back press.
public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
{
if (e.KeyCode == Keycode.Back)
{
// Transition your Fragments here
var Activity = new Intent(this, typeof(Activity1));
StartActivity(Activity);
Finish();
}
return base.OnKeyDown(keyCode, e);
}