Android Programming Tutorials

(Romina) #1
A Restaurant In Your Own Home

You will also need to add a new string resource, named empty, that will go


into the app widget if there is no restaurant available (e.g., the database is


empty).


Make sure you have at least two restaurants in LunchList – we will need


more than one to show the random effects, particularly starting with the


next tutorial.


At this point, compile and reinstall the application. Also, if you got rid of


the empty app widget, add a new one to your home screen. You should see


the name of one of your restaurants:


Figure 58. The app widget, showing the random restaurant

As app widgets go, this one is very unimpressive. However, we will make it


somewhat better in the next tutorial.


323
Free download pdf