0
String cardpath = Global.directory + longPressBtn.getText().toString() + ".jpg";
System.out.println(cardpath);

AlertDialog imageDialog = new AlertDialog.Builder(mContext).create();
LayoutInflater inflater = LayoutInflater.from(mContext);
imageDialog.setTitle("Title");
View view = inflater.inflate(R.layout.cardpopup, null); 
File imgFile = new File("cardpath");
Bitmap myBitmap = BitmapFactory.decodeFile(cardpath);

ImageView myImage = new ImageView(mContext);
myImage.setImageBitmap(myBitmap);

imageDialog.setView(view);
imageDialog.show();

我正在尝试在按下按钮时显示带有图像的弹出窗口。上面的代码是我的尝试,它不起作用。该cardpath变量应该是图像的绝对路径的字符串。但是,按下按钮时,什么也没有出现。卡路径定义的图像确实存在,并且我具有外部存储读取权限,所以我不确定出了什么问题。

4

1 回答 1

0

Since i don't see you scaling your image, check your logcat - you will probably see a line OpenGLRenderer = Bitmap too large to be uploaded into a texture.

于 2013-06-14T05:39:27.653 回答