【发布时间】:2012-01-20 12:22:39
【问题描述】:
我编写了一个简单的代码,用于从任何支持图像的应用程序中导入图像
Intent intent = new Intent(Intent.ACTION_GET_CONTENT, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setType("image/*");
startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE);
从图库中导入图像时,代码可以正常工作,但只要我从我的摩托罗拉 xoom 中的 picasa 导入图像。它返回 null 并以 NullPointerException 强制关闭。
有人对此有任何想法吗?
【问题讨论】:
-
你在哪里得到
NllPointerException? -
将activityresult上的图片作为位图导入并使用其属性后,我得到NullPointerException.....
-
Uri selectedImageUri = data.getData(); String selectedImagePath = imageUtil.getPath(selectedImageUri,Main.this); BitmapDrawable d =(BitmapDrawable)BitmapDrawable.createFromPath(selectedImagePath);现在在访问“d.getWidth”时,我得到 NullPointerException..
标签: android