in dialog box set view insert drawable image how can set in android
-
28-09-2019 - |
Question
i am implementing puzzle game application in this application create one button in click the button display original image of the puzzle .original image display in dialog box then click ok return in to actual page how can implemented
bitmapOrg = BitmapFactory.decodeResource(getResources(),mThumbIds[GameActivity.level]);
please forward some solution its urgent this issue pending more days thanks in advance
Solution
I think you need to set a icon in dialog box.
If so you can do it by the following
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Message");
builder.setCancelable(false)
.setPositiveButton("Ok",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
AlertDialog alert = builder.create();
alert.setTitle("Title");
alert.setIcon(R.drawable.your_image);
alert.show();
Thank you
OTHER TIPS
If you want to set image in dialog box, this is a rough answer:
ImageView image=new ImageVIew(this);
image.setLayoutParams(new LayoutParams(your width, height));
Set the background image on this imageview either by using drawable or by setting bitmap
new AlertDialog().Builder(this).setView(image).show();
This is just a rough solution, but it will give you an idea