🔒 Closed Paano i-log o i-capture ang error sa android phone?

Status
Not open for further replies.

dee-u

Forum Guru
First time ko gumamit ng xamarin, at may error siya kapag nagko-connect ako sa RESTful API kapag unang beses kong pinipindot yung button, sa sumusunod na pindot ay gumagana na siya. Paano ba i-capture yung error? Gumagamit ako ng android device na naka-connect using USB.

C#:
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();

    }
}
 
Oo nga pala, hehe, puwede pala, akala ko kailangan ko pang i-log mismo dun sa android phone. Thanks!
 
Oo nga pala, hehe, puwede pala, akala ko kailangan ko pang i-log mismo dun sa android phone. Thanks!
every time may error kasi yan sa catch na rerekta yan. try mo tanggalin yung try catch na yan, makikita mo error nyan. yan ang purpose ng try catch. iniiwasan natin yung pag crash pag may error.
 
Status
Not open for further replies.

About this Thread

  • 3
    Replies
  • 383
    Views
  • 2
    Participants
Last reply from:
saketnanga00

Trending Topics

Online now

Members online
409
Guests online
2,393
Total visitors
2,802

Forum statistics

Threads
2,331,537
Posts
29,258,780
Members
1,149,683
Latest member
xcalibur
Back
Top