The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.


Tutorial #11 - Adding Simple Content

Now that we have seen how to work with assets, we can start putting them to use, by defining some “help” and “about” HTML files and displaying them in their respective activities.

This is a continuation of the work we did in the previous tutorial.

You can find the results of the previous tutorial and the results of this tutorial in the book’s GitHub repository.

Step #1: Adding Some Content

In Android Studio, right-click over the main source set directory, choose New > Directory from the context menu, fill in the name assets in the dialog, and click OK. This should give you an app/ module that looks like:

EmPubLite Project, Showing assets/ in main/ of app/
Figure 268: EmPubLite Project, Showing assets/ in main/ of app/

In assets/, create a misc/ sub-folder, by right-clicking over the assets/ folder and choosing to add a new directory named misc (e.g., New > Directory from the Android Studio context menu), giving you something like:

EmPubLite Project, Showing assets/misc/ in main/ of app/
Figure 269: EmPubLite Project, Showing assets/misc/ in main/ of app/

In assets/misc/, create two files, about.html and help.html. In Android Studio, right-click over the assets/misc/ folder in the project explorer, choose New > File from the context menu, fill in the desired filename in the dialog, and click OK.

The actual HTML content of these two files does not matter, so long as you can tell them apart when looking at them. If you prefer, you can download sample about.html and help.html files from the application’s GitHub repository, via the links.

Step #2: Using SimpleContentFragment

The preview of this section is [REDACTED].

Step #3: Launching Our Activities, For Real This Time

The preview of this section was traded for a bag of magic beans.

Step #4: Getting a Bit More Material

The preview of this section was accidentally identified as an Android 'tasty treat' by the Cookie Monster.

Step #5: Seeing the Results

The preview of this section left for Hollywood to appear in a reality TV show.

In Our Next Episode…

The preview of this section is in the process of being translated from its native Klingon.