Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialThang Pham Quoc
73 PointsHow does "onPostExecute" know which JSONObject to work with ?
I don't see any method invocation like : onPostExecute(doInBackground(Object...params)); so how does onPostExecute know which JSONObject to work with ?
1 Answer
haunguyen
14,985 PointsI had similar question while looking up a progressbar method. I think you are referring to an AsyncTask procedure, right?
http://developer.android.com/reference/android/os/AsyncTask.html
If so, onPostExecute method requires 1 parameter (as declared in the method constructor protected void onPostExecute(Long result)
)
That parameter is the returned value passed in from the doInBackground method.
Since each async task has 1 doinbackground method (that returns 1 type of value) and 1 onPostExecute method, they are being tracked together.
Thang Pham Quoc
73 PointsThang Pham Quoc
73 PointsThanks a lot. I understand now :)
haunguyen
14,985 Pointshaunguyen
14,985 Pointsno problem, I had the same problem trying to understand these black box codes.