So I have my class extending AppCompatActivity. On button press I'm creating new Async task for internet connection passing reference to this class, and at the end of doInBackground I call function in my class.
private LoginAct act;
[...]
@Override
protected Object doInBackground(Object[] params) {
try
{
//LOGIN into account or create new one - returns id (as string str)
int id = Integer.parseInt(str.toString());
System.out.println(id);
//id is fine
act.postexecute(id);
} catch (Exception e) {
return "ERROR: " + e.getMessage();
}
return null;
}
as for now, everything is fine, but than postexecute method not work as it's suppsed to:
public void postexecute(int id)
{
//it works fine here
if(id == 0)
{
System.out.println("postexecuting!");
edPas.setError("Nickname and password don't match!");
loadBar.setVisibility(View.GONE);
}
else
{
System.out.println("Less postexecuting!");
onBackPressed();
}
}
Problem is, no matter what id input is, neither if or else statements prop. I have no idea, what the problem could be, and all questions I've seen around weren't even close to my problem...
Aucun commentaire:
Enregistrer un commentaire