Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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>