TextView and strings.xml: Android Programming



Move strings from the layout into strings.xml for internationalization, access a TextView via Java code, and have Java code read from strings.xml.

Builds on video: https://www.youtube.com/watch?v=aE5f1tV5nU4

1. Add a TextView, move text to strings.xml, change formatting.
2. Use Java to change the text on a TextView.
3. Use Java to load string from strings.xml and change text on TextView.

Uses a button for the demo, and briefly reviews an exception.

source

9 comments

  1. Hello my friend.
    I am a big fan of your YouTube channel and learn a lot from you, 
    I have a strange problem and couldn't found an answer maybe you can help me?

    In Android studio I put 2 button one in right side and one on the left side..

    When I run the app on the emulator everything ok BUT when I run the app on my own phone the button switch sides.
    How can I fix it??
    Please help me. 

    Thank you so much.

  2. Hi! What if I wanted to extract other things besides strings from a different xml file? like if i had <car> mazda </car> in an xml file called cars.xml; how would i go about displaying that in textview?

    Great video by the way! I liked that you walked through the errors.

Comments are closed.