Issue
Lets say I have a class like below;
class X {
private List<String> listing;
class XAsync extends AsyncTask... {
<normal async task class>
doInBackground {
listing = <populating from a web service>
}
}
public redirectList() {
while(listing.size == 0) {
continue;
}
redirect(listing);
}
}
How to make sure that listing parameter sending within redirect method is populated successfully from async task? Making sure that listing is populated with while clause is a best practice or not?
Thanks
Solution
You should return the value to be put in listing
from doInBackground
, and then use it in onPostExecute
. That is, your redirect(listing);
call should be in onPostExecute
, and then you won't have any need for that while loop.
Answered By - Ryan M
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.