I am having lots of trouble with variable and parse Querys. Some of my solutions are to create a method and put parameters into it and call it from the query and insert the values that i need as parameters. but i need to make use of those values in onCreate. When put this variables as Global
ParseObject empresa;
String stringEmpresa;
String tipoDeEmpresa;
String tipoEmpresa;
String role;
and the put the values inside the query when I use them on onCreate they are null.
public void parseQuery(){
ParseQuery<ParseUser> query = ParseUser.getQuery();
query.include("Empresa");
query.include("ComercialAsignado");
query.include("ComercialTallerAsignado");
query.getInBackground(ParseUser.getCurrentUser().getObjectId(), new GetCallback<ParseUser>() {
@Override
public void done(ParseUser object, ParseException e) {
if (e == null) {
queryEmpresa();
tipoDeEmpresa = object.getString("tipoDeEmpresa");
role = object.getString("Rol");
initBottomFromRolUser(role, tipoDeEmpresa);
showItemNVFromRol(role, tipoDeEmpresa);
initFloatingButton(tipoDeEmpresa);
}
}
});
I also tried to retrieve the data with another method but it retrieves the wrong data, here is a screenshot. The other problem is that is not retrieving all the columns presented in my user class, this is why
tipoEmpresa=user.getString("tipoDeEmpresa");
this is null.
Also note that my Rol for demo3 is Administrador, not Usuario.
Remember setting those global variables inside the done method doesn't let me use these variables in onCreate