How to display an image in a dialog box

This code will display a dialog box with "Hello World", but I want to display image like: enter image description here also in the same dialog box.

Can anybody help me?

private void showDialog(String message) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Hello World"); builder.setCancelable(false); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); AlertDialog alert = builder.create(); alert.show(); } 
+4
source share
3 answers

Here is a link that will lead you to a tutorial on how to do this ...

http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog

Enjoy it!

Tip:

Search on this site you can find most of the basic foundations of http://developer.android.com

Sentence:

HIT four times a space before writing any code ... it will attract more people to answer your question as it will look well written

Happy coding!

+4
source

Use CustomDialog instead of the standard one.

Checkout for customDialog: http://www.helloandroid.com/tutorials/how-display-custom-dialog-your-android-application

Hope this solves your problem.

+2
source
 private void showDialog(String message) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Hello World"); builder.setIcon(R.drawable.hello); builder.setCancelable(false); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); AlertDialog alert = builder.create(); alert.show(); } 
0
source

All Articles