Get Null In Asynctask
my AsyncTask codes return null when try to login. I got confused, why on device it can throw the toast 'return null...' but on emulator it force close, anyone please help me to fix
Solution 1:
You're confusing 'response' with 'result'. In onPostExecute(String result) 'result' is the result from your asynchronous execution in doInBackground(). The response member variable of LoginTask is never used and I do not see why you'd want it at all. Remove it and use 'result'.
Solution 2:
Log.d("Response",response); response isnull.
In tryLogin you are returning NULL if there is an exception. Try changing it to some value and test again.
catch(IOException e)
{
e.printStackTrace();
Log.d("Error",e.getMessage());
returnnull;
}
Post a Comment for "Get Null In Asynctask"