Android Programming Tutorials

(Romina) #1
More Home Cooking


  • We then attach the PendingIntent to the name widget in the app
    widget


Now, if you recompile and reinstall the project, you will see that pressing


the name of the restaurant brings up the restaurant's DetailForm.


Extra Credit...............................................................................................


Here are some things you can try beyond those step-by-step instructions:



  • Rather than show a random restaurant, keep track of the last
    restaurant viewed and cycle through them in progression, looping


back to the first in the list when you reach the end. Consider adding
a second ImageButton to move backwards through the list.


  • Add another button that, when clicked, displays a Toast of the notes
    for the currently-viewed restaurant.


Further Reading........................................................................................


App widgets are covered in a chapter of The Busy Coder's Guide to


Advanced Android Development.


333
Free download pdf