A (175)

(Tuis.) #1
CHAPTER 14: Android Content Providers: Providing Data to Applications 549

Figure 14-45. Add a Toast.makeText( ) method call with LENGTH_LONG constant and reference electedViceroy


Now use the Run As ➤ Android Application menu sequence and launch the Nexus One AVD.
Select the Contact Galaxy Rulers menu item and fire up the ContactGalaxy Activity and your
TableLayout UI design.


Click on each of the Add Galaxy Viceroy Button UI elements and make sure that the Toast broadcast
messages appear on the screen. Then test the database write (add) by clicking the first List All
Galaxy Rulers Button UI element. Make sure that all of the Emperors and Viceroys are listed, as they
now should be. Finally, test the fifth UI Button element and make sure that the .finish( ) method call
returns you to the MainActivity.java class. If it does, you have successfully implemented database
reading and writing in your application. See Figure 14-46.

Free download pdf