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

Blog Reader -> Getting Data From The Web -> Moving Work from the Main Thread to an AsyncTask -> Code Challenge -> Task 2

Could someone please take a look @ Blog Reader -> Getting Data From The Web -> Moving Work from the Main Thread to an AsyncTask -> Code Challenge -> Task 2 (Declare the 'doInBackground(Object... params)' method inside your custom AsyncTask. Make it 'protected', return a String, and then simply return an empty String in the body. Don't forget the '@Override' annotation on the line above the declaration!).

Within this challenge it says to "return a String" and then says "return an empty string" right afterwards. I'm a little confused on how to do both and confused as to what String I'm supposed to declare with what value if any?

John Hedge - In this post it looks like you went a bit overboard with the tags.

Generally a post only needs a 1 or 2 tags. The primary purpose of tags is for helping future forum searchers find posts with similar content.

There's a great bit on tags over on this site's FAQ http://pineapple.io/faq check out the section labeled a word about tags to read more about the philosophy behind making good tags.

Thank you James. I will try to be more mindful of this in the future. Could you please take a look at this code challenge to see if you can assist?

I actually haven't down the Android course yet, so I won't be much help but Ben Jakuben might.

1 Answer

John Hedge - Part of the declaration for the 'doInBackground' method is to specify the return type for the method. In this task the first mention of String is referring to the method's return type. Now when the task mentions to return an empty string in the body it is referring to the line of code you will write at the end of the method returning an empty string.

I'm trying not to give away the exact answer, so I hope I'm making my point and not making it more confusing for you.

You're answer is very helpful and helped me understand the question. Thank you. I'm trying to get this correct but honestly I'm drawing a blank on this. Until this I've been able to look at my projects and figure it out.

I figured it out!!! Thank you!

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Sorry you had trouble, John! David provided a great answer without giving away the code. Glad you got it working! :smile: