Narasimha
Narasimha

Reputation: 3766

in dialog box set view insert drawable image how can set in android

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

Upvotes: 2

Views: 3580

Answers (2)

viv
viv

Reputation: 6177

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

Upvotes: 0

Labeeb Panampullan
Labeeb Panampullan

Reputation: 34833

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

Upvotes: 2

Related Questions