Monday, 15 June 2015

java - AsyncTask has errors - beginner -



java - AsyncTask has errors - beginner -

eventually wanting method values in text document , homecoming true of username , password nowadays there. having problems implementing asynctask. have tried follow guide @ http://developer.android.com/reference/android/os/asynctask.html have had no success.

the error getting @ homecoming type on doinbackground method "the homecoming type incompatible asynctask.doinbackground(string[])"

private class authenticateuser extends asynctask<string, integer, boolean> { string user; string pass; protected void onpreexecute(string uname, string passwd) { user = uname; pass = passwd; } protected boolean doinbackground(string... strings) { homecoming true; } protected boolean onpostexecute(boolean v) { homecoming v; } }

i know not way authenticate user @ all. trying figure out. thanks.

the problem here asynctask extensions generic , need 3 types: asynctask<params, progress, result> may void or class, not primitive info types.

so happens told compiler doinbackground returns primitive boolean expecting instance of class boolean. , "the homecoming type incompatible" error.

just alter protected boolean doinbackground(string... strings) protected boolean doinbackground(string... strings) , should fine.

java android android-asynctask

No comments:

Post a Comment