O'Reilly logo

Mastering Android Studio 3 by Kyle Mew

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Raw text resources

To demonstrate the scrolling behavior, the string used in the preceding text view was a lengthy one. This was placed in the strings.xml file, and although this works perfectly well, it is not an elegant way to manage lengthy texts. This kind of text is better dealt with as a text file resource that can be read at runtime.

The following steps demonstrate how this is done:

  1. Prepare a plain text file.
  2. Create a directory named raw inside the res directory of your project by right-clicking on the res folder in the project explorer and selecting New | Directory.
  3. Add the text file to this directory.
Project directories can be opened quickly from the explorer context menu.
  1. Open the java activity with the text view you wish to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required