-1

I have an image and I am currently setting it on an imageview.

I want that when the Imageview is clicked , a pop up like a dialog box should appear that displays the image .. Any method how can I acheive this.

                Context mContext = getApplicationContext();
                Dialog dialog = new Dialog(mContext);

                dialog.setContentView(R.layout.customdialog);
                dialog.setTitle("wateva");

                ImageView ivDialog = (ImageView) dialog.findViewById(R.id.ivDialog);
                String filepath = Environment.getExternalStorageDirectory().getPath();
                folder = new File(filepath,"checking");

                File fa = new File(folder,"bmp1.png");
                Bitmap bmpa = BitmapFactory.decodeFile(fa.getAbsolutePath());
                Log.d("error " , "here");
                ivDialog.setImageBitmap(bmpa);
                dialog.show();
Kumar
  • 169
  • 2
  • 5
  • 12

1 Answers1

2

use CustomDialog for that .Create layout that have Imageview and othe Components and set it to Dialog.

Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.dialoglayout);
ImageView imgView=(ImageView)dialog.findViewById(R.id.imagview);
//set image to imgView
dialog.show();
Samir Mangroliya
  • 39,918
  • 16
  • 117
  • 134
  • `ImageView ivDialog = (ImageView)dialog.findViewById(R.id.ivDialog);`............see my code also – Samir Mangroliya May 29 '12 at 11:03
  • now i m getting this error android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application – Kumar May 29 '12 at 11:04
  • yup i corrected the error http://stackoverflow.com/questions/2634991/android-1-6-android-view-windowmanagerbadtokenexception-unable-to-add-window – Kumar May 29 '12 at 11:07