Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

The SL4A Android API

The SL4A technology provides a high-level API to the low-level Android API, and SL4A’s API is documented in the online API reference:

Recall the code from earlier, which demonstrated a minimal Android SL4A app:

image with no caption

Six calls to the Android API let you create a list of selectable items in a dialog, together with positive and negative buttons, which are used to indicate the selection your user made. Note how each of the calls to the Android “dialog” API results in something appearing on screen.

image with no caption

Android Code Magnets

Here is the code to a program that queries your web server for the list of names as a JSON array and then displays the list on the smartphone. The only trouble is, the second half of the program is a bunch of mixed-up code magnets at the bottom of the screen. Your job is to rearrange the magnets to complete the program.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint