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
Matthew Grant
3,703 PointsFun Facts: My button and text on fun fact disappears when i click on button :S. Please help!
I checked my code with the tutorials and I couldn't find what I was doing wrong. When I click on the 'show another fact' button on my app, it disappears and a vertical white box says '5showanotherfact'. Does anyone know where I could look to try and fix this? Thank you.
*I attempted to add a screenshot but I don't think its possible here.
1 Answer
Tieryel Northwind
7,382 PointsIt's difficult to say without looking at your code but try looking to make sure your Button is referencing your Button id and FactLabel is referencing your text view. Also make sure that you are setting text correctly with factLabel.setText(fact).
final TextView factLabel = (TextView) findViewById(R.id.factTextView);
final Button showFactButton = (Button) findViewById(R.id.showFactButton);
factLabel.setText(fact);
Hope this helps.