Im trying to get username when I try to login to wev service.I need this username to check did I this right or no.But have NPE when try to get data,but when I just make Toast wi
SignInResults.java // Model class
clas SignInResults {
public Boolean status;
public Auth auth;
public User user;
}
User.java //User Model
public class User {
public String userId;
public String username;
public String avatar;
}
checkout this code in onResponse function
if (response.isSuccess()) {
SignInResults results = response.body();
if(results != null) {
String userName = results.user.username;
Log.d("User Name ==>> ", userName);
}
} else {
// Do whatever you want if API is unsuccessful.
}