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 trial

Android Build a Blog Reader Android App Adapting Data for Display in a List Finishing Our AsyncTask

Niranjan Deodhar
PLUS
Niranjan Deodhar
Courses Plus Student 1,941 Points

Step 2 of this challenge

I passed step one, yet on step 2, I get told to make sure mStatus is set using the result variable - is there some error in the code checker here?

@Override protected void onPostExecute(String result) { String mStatus = result; updateStatusLabel(); }

2 Answers

Stone Preston
Stone Preston
42,016 Points

you redeclared the mStatus variable. its already been declared at the top of the file. just reference it using its name.

//below is the correct way to reference the mStatus member variable
@Override
    protected void onPostExecute(String result)
    {
      //since it was already declared above, just use its name
      mStatus = result;
      updateStatusLabel();
    }

whereas before you had

//this is incorrect
@Override
    protected void onPostExecute(String result)
    {
      //you redeclared it here, dont do that
      String mStatus = result;
      updateStatusLabel();
    }
Niranjan Deodhar
PLUS
Niranjan Deodhar
Courses Plus Student 1,941 Points

Good point, thanks again, although I am still intrigued how I passed Step 1 of the challenge, the error in re-declaring mStatus happened at that step and yet I could get to step 2. But anyway, that's a side issue I guess, I can carry on for now. Best regards