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: Using a Class

Shaun Kelly
Shaun Kelly
5,648 Points

I came across a problem while trying to refactor and then rename the "facts" to "mFacts" on the String array.

It shows how to do this on the video called Simple Refactoring: Using a class, at around 4:35. Once I typed out mFacts and then pressed enter a box came up at the bottom on Android Studio and had information about it but I did not understand. I typed them out manually and I think it's seemed to work but i'm trying to understand why it didn't working in the first place.

2 Answers

Harry James
Harry James
14,780 Points

Hey Shaun!

There's many reasons why this could be! I don't know for definite the reason why if you can't remember the message said but, hopefully you won't get it again! If you do, feel free to write in this post or a new one about it and maybe me or someone else will understand what the message means!

It may also just have been a glitch in the IDE (I've had my fair few). It's still in Beta right now so, bugs are expected!

Hope it helps and, if you have any more questions, feel free to ask!

Shaun Kelly
Shaun Kelly
5,648 Points

Hey thanks I think the problem has been solved now but I have a new problem. When I run the app on my simulator, a black box with white text pops up and says "Unfortunately, Practise has stopped." "Practise" is the name of the app I created. I looked in the android logcat and this is what was shown with loads more info of the same stuff..

11-14 18:20:15.360 848-848/com.example.shaun101.practise E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.example.shaun101.practise, PID: 848 java.lang.StackOverflowError at java.util.Random.<init>(Random.java:67) at com.example.shaun101.practise.NameBook.getmNames(NameBook.java:29) at com.example.shaun101.practise.NameBook.getmNames(NameBook.java:35) at com.example.shaun101.practise.NameBook.getmNames(NameBook.java:35) at com.example.shaun101.practise.NameBook.getmNames(NameBook.java:35)

Harry James
Harry James
14,780 Points

Hey Shaun! It looks like something is going wrong on line 35 of NameBook.java. Take a look and see if you know what it is. If you have no idea, provide it and any appropriate lines of code here and I'll take a look for you :)