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!
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 trial
Sara Nocentini
1,157 PointsHelp, CodeChallenge Stage 4, task 2
Hi, I get this error and I don't know why: Bummer! Make sure you set the 'mStatus' label using the 'result' variable passed into the 'onPostExecute()' method.
The task is the following: Inside 'onPostExecute()', set the member variable 'mStatus' to the value passed into 'onPostExecute()'. Then call the 'updateStatusLabel()' method of 'CustomActivity'.
and my answer:
import android.os.AsyncTask;
import android.os.Bundle;
public class CustomActivity extends Activity {
public String mStatus;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom);
CustomAsyncTask task = new CustomAsyncTask();
task.execute();}
protected void updateStatusLabel() {
super.updateStatusLabel();}
protected class CustomAsyncTask extends AsyncTask<Object, Void, String> {
@Override
protected void onPostExecute(String result) {
mStatus = result;
updateStatusLabel();}
}
}
Thanks
1 Answer

Nidhi Saini
2,627 PointsHi Sara,
Take a look at this link -http://developer.android.com/reference/android/os/AsyncTask.html Read this example http://www.compiletimeerror.com/2013/01/why-and-how-to-use-asynctask.html#.U-kpk_ldV04
Let me know if you need any help.
Sara Nocentini
1,157 PointsSara Nocentini
1,157 PointsSorry I don't know how to copy it without loosing the format.