11/17/09

This application shows you how to add an imagebutton to your Android form and display a message using the Toast widget. A toast is a view containing a small message for the user. The toast class helps you create and show those. You can download the project file.

1. Create a new project2. Open Main.xml in res/layout3. Add a ImageButton to layout file main.xml4. Set the Background property to an image in your project5. Note the value for the imageButton ID6. In ButtonActivity.java add the following code to the OnCreate() method. Make sure that R.id.ImageButton01 matches your imageButton’s ID.