Pages

Friday, May 20, 2011

Exercise: Add a icon on Dialog

Extends from the previous exercise, Exercise: Menu and Dialog. A icon will be added on the About me Dialog, as shown:



Save the icon, , in the folder res/drawable.

Add one line in the openOptionsDialog() class:



private void openOptionsDialog()
{
new AlertDialog.Builder(this)
.setTitle(R.string.app_about)
.setIcon(R.drawable.android)
.setMessage(R.string.app_about_message)
.setPositiveButton(R.string.str_ok,
new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialoginterface, int i)
{
}
})
.show();
}


Next: Simple steps to change the drawable icon with Transparency background using GIMP

No comments:

Post a Comment

Popular Posts