XAMARIN FORMS (Android) - App is kicked out after successfull user validation

KhaiFMsia 71 Reputation points

I have a button
<Button Text="LOGIN" Clicked="ProceedLogin" x:Name="BtnLogin" />

After button clicked, it will check my API to validate user credential, if success, then the app should navigate to the next page, but it just kicked out. Already try catch also not show any error, just KICKED OUT. Need some advise from experts here. Thank you.

private async void ProceedLogin(object sender, EventArgs e)

        Detail user = new Detail
            usrId = myId.Text,
            usrPassword = myPwd.Text

        string getlogin = await client.GetStringAsync("*<call my webapi to validate user>*");

        Login login = JsonConvert.DeserializeObject<Login>(getlogin);
        if (login.PromptMessage != "")
            this.IsBusy = false;
            BtnLogin.IsEnabled = true;
            await DisplayAlert("", login.PromptMessage, DisplayErrorMessage("6"));
            Application.Current.Properties["isLogged"] = true;
            Application.Current.MainPage = new NavigationPage(new PageNotice());  //should go to next page


A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,324 questions
{count} votes