Overriding the OnBackPressed activity
With our iOS implementation we integrated an override to the navigation back button, so when a user leaves the ClientListViewController
, we ask the user if they would like to signout from the ChatHub
. We are going to do the same here but on the Android platform. We will be building the alert from the AlertDialog.Builder
framework:
public override void OnBackPressed() { //Put up the Yes/No message box AlertDialog.Builder builder = new AlertDialog.Builder(this); builder .SetTitle("Chat") .SetMessage("Would you like to signout?") .SetNegativeButton("No", (sender, e) => { }) .SetPositiveButton("Yes", (sender, e) => { _presenter.Signout(); }) .Show(); }
We start with instantiating...