In my Activity i have a ImageView to show a picture. When i click the ImageView i want a Dialog to appear and to set the view of the Dialog to the ImageView.
I tried it that way:
public static void showImageDialog(Context context, String title, ImageView imageView) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(title);
builder.setCancelable(false);
builder.setView(imageView);
builder.setPositiveButton(context.getResources().getString(R.string.button_back), new DialogInterface.OnClickListener() {
/**
*
*/
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.create().show();
}
Unfortunately i cant set an ImageView in my Activity and in the Dialog at the same time:
11-03 13:29:49.648: E/AndroidRuntime(1560): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
So how can i create a copy or a clone of my ImagView. The following ofcourse does not work because its a reference:
ImageView temp = this.imageView;
0 comments:
Post a Comment