First time to use Xamarin and I am trying to use a RESTful API for logging in, this code works but the first time I am clicking the BtnConnect it is throwing out an error and I am not sure how can I capture the error, I am using an android device connected thru USB, how can I capture or log the error?
Code:private async void BtnConnect_Click(object sender, EventArgs e) { try { txtUsername = FindViewById<TextView>(Resource.Id.txtUsername); txtPassword = FindViewById<TextView>(Resource.Id.txtPassword); string username = txtUsername.Text; string password = txtPassword.Text; var user = new UserModel { username = username, password = password }; ApiResponse response = await ApiUtils.GetApiService().Login(user); Toast.MakeText(this, response.message, ToastLength.Long).Show(); } catch (Exception ex) { Toast.MakeText(this, ex.StackTrace, ToastLength.Long).Show(); } }




Reply With Quote