I assume you need t o display a Image in a custom dialog
Define dialog.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
</RelativeLayout>
In your activity on button click display a dialog
Button b= (Button) findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
showpopup();
}
});
public void showpopup()
{
Dialog d = new Dialog(MainActivity.this);
d.setContentView( R.layout.dialog);
d.setTitle("my title");
ImageView iv = (ImageView) d.findViewById(R.id.imageView1);
iv.setImageResource(R.drawable.afor);
// set your image here. I have used a resource from the drawable folder
d.show();
}
