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 with Java Improving Our Code Adding an App Icon

Linda de Haan
Linda de Haan
12,413 Points

Fun Facts has stopped

I'm seeing several other questions relating this issue, but none really solve my problem or are never answered, so I'm asking it here again.

After adding the colorWheel to the app I'm getting an error. If I run the app, it shows up, but after clicking the button "Show another fun fact", the app shuts down and throws an error popup window saying "Fun Facts has stopped". This is what is showing in the Logcat:

02-03 13:07:03.751 7707-7707/nl.iamlinda.funfacts E/AndroidRuntime: FATAL EXCEPTION: main
                                                                Process: nl.iamlinda.funfacts, PID: 7707
                                                                android.content.res.Resources$NotFoundException: String resource ID #0xffb7c0c7
                                                                    at android.content.res.Resources.getText(Resources.java:339)
                                                                    at android.widget.TextView.setText(TextView.java:5496)
                                                                    at nl.iamlinda.funfacts.FunFactsActivity$1.onClick(FunFactsActivity.java:40)
                                                                    at android.view.View.performClick(View.java:6294)
                                                                    at android.view.View$PerformClick.run(View.java:24770)
                                                                    at android.os.Handler.handleCallback(Handler.java:790)
                                                                    at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                    at android.os.Looper.loop(Looper.java:164)
                                                                    at android.app.ActivityThread.main(ActivityThread.java:6494)
                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

1 Answer

Linda de Haan
Linda de Haan
12,413 Points

Ok, found the problem. Turns out I did have a problem in my code. It was in FunFactsActivity.java in the onClickListener. I wrote showFactButton.setText(color); where it should have been showFactButton.setTextColor(color); Doh!