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 Simple Android App (2014) Improving Our Code Simple Refactoring: Creating a Class

I'm kind of stuck here. Suggestions?

So far up to this point, I was following the videos. At this one however, I pasted my code into the new FactBook class. I had some errors. One of the suggestions in the forum on this video when receiving this error was to try and clean and/or rebuild the app. When I cleaned the app, all my code that I had taken from the FunFactsActivity class was deleted. It seems that the cleaning deleted the whole FactBook class.

I could go back and redo all the steps, I suppose. Trouble is, I'm not even sure which point I need to go back to.

I think I was able to fix it by cheating a little bit with Ben's code in the download section. I created yet another class opened Ben's FactBook file and copied his code in. Not sure what happened the first time with that error. Looks like others got that error too previously, but it's not clear why. Oh well.

1 Answer

I am glad you got it right. Did you saved it? If you forgot to do that, that could be the reason one. Overall it is great that it is functioning now :)