Change this
Bitmap result = null;
InputStream is = connection.getInputStream();
Bitmap img = BitmapFactory.decodeStream(is);
img = result;
to
Bitmap img = null;
InputStream is = connection.getInputStream();
Bitmap img = BitmapFactory.decodeStream(is);
result = img;
and return result
in doInBackground()
. You have them switched around so 'img' will be null
no matter what happens.
Also, you can't use Toast
in doInBackground()
as this method isn't run on the UI
thread. You will need to make that a Log
or put your Toast
in onPostExecute()
or onProgressUpdate()
. These are the things I see. If you are still having problems then you need to be a little more clear on what specifically. You will need to debug and use breakpoints to see what isn't being returned that should be and pinpoint a little more what the problem is
No comments:
Post a Comment