Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i return an arraylist from AsyncTask? [duplicate]

I have a problem is the following: I have to take some data from mysql from android, and for that I do it with php, but since I use android 4.0 put through an AsyncTask. The problem is that I don't know how to return the resulting arraylist.

like image 806
Squall Avatar asked Nov 19 '25 22:11

Squall


1 Answers

A convenient way is to make an AsyncTask an anonymous class inside your Activity class. Then in onPostExecute method you have access to all fields that belongs to your Activity + final objects from the method you create that AsyncTask in.

like image 132
Michał Kisiel Avatar answered Nov 22 '25 13:11

Michał Kisiel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!