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) Basic Android Programming Adding the onClick() Method

String text question

Why when we add a new screen of the app clicking the button, we do don't have to change the "Did you know?" text, it always there, what tells Android studio to keep showing it on every new screen?

2 Answers

Stone Preston
Stone Preston
42,016 Points

you arent adding a new screen each time you press the button. its the same screen every time, you just change the text of the button and change the color of the background. the textView that says "Did you know" never goes away, its always on the screen because we never change the screen.

Ohh now I understand, thanks a lot!, now when I run the app the emulator lets me edit the textView that has the fun fact, is that normal?

Stone Preston
Stone Preston
42,016 Points

probably dont want the text view to be editable. in the xml file for the layout you can add some attributes to your edit text node to make it not editable:

<YourTextView>
        android:clickable="false" 
        android:cursorVisible="false" 
        android:focusable="false" 
        android:focusableInTouchMode="false">
</YourTextView>