Android Programming Tutorials

(Romina) #1

TUTORIAL 34


More Home Cooking


In this tutorial, we will add a few more features to our existing app widget,


such as a button to choose another random restaurant. Also, if the user taps


on the name of the restaurant, we will open up the detail form activity for


that restaurant.


Step-By-Step Instructions........................................................................


First, you need to have completed the previous tutorial. If you are


beginning the tutorials here, or if you wish to not use your existing work,


you can download a ZIP file with all of the tutorial results, and you can copy


the 33-AppWidget edition of LunchList to use as a starting point.


Step #1: Implement a Shaker.............................................................


Next, you will need an image to go on an ImageButton that will serve to


change the restaurant shown by the app widget to another random


restaurant.


If you examine the 34-AdvAppWidget project in the book's source code


repository, you will see that there is a ff.png file there, culled from the


Android open source project, that you could use. Or, substitute your own


graphic as you see fit – just name it ff.png to match how it is used later in


this tutorial.


325
Free download pdf