So, I am trying to get my data from User table on Firebase and after I return and try to set the result to a Label the screen just go full white (I am using xamarin for android if it matter) and nothing happen. Maybe I do something wrong or I missed something, I am also kinda blurred on how task work. I anyone have any idea please fell free to give me any directions or any other alternatives. This is the code I used .Thank you
UserDetailsRetrive.cs
public async Task<UserDetails> getUserInfoDetails()
{
FirebaseClient client = new FirebaseClient("https://xyz.firebaseio.com/");
return (UserDetails)(await client.Child("user").OnceAsync<UserDetails>()).Select(item => new UserDetails
{
first_name = item.Object.first_name,
last_name = item.Object.last_name,
username = item.Object.username,
birthdate = item.Object.birthdate,
newsletter = item.Object.newsletter,
term_condition = item.Object.term_condition
});
Profile.cs
public void setUserInfo()
{
UserDetailsRetreive usr = new UserDetailsRetreive();
UserDetails userDetails = usr.getUserInfoDetails().Result;
username.Text = userDetails.username.ToString();
}
UserDetails.cs
class UserDetails
{
public string first_name { get; set; }
public string last_name { get; set; }
public string username { get; set; }
public string birthdate { get; set; }
public bool newsletter { get; set; }
public bool term_condition { get; set; }
}