上传文件失败,提供结果resultinfo

时间:2015-08-14 09:59:32

标签: android android-intent

当我从画廊读取图像时,一切正常。但是当我从文件管理器( Intent { dat=file:///storage/emulated/0/Download/HD-Wallpapers1.jpeg } )读取图像时,我收到了错误。

Intent intent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);                   
startActivityForResult(Intent.createChooser(intent,"Picture"), 1);

--- onactivity结果方法---

Uri selectedImageUri = data.getData();
imagepath = getPath(selectedImageUri);
Bitmap bitmap=BitmapFactory.decodeFile(imagepath);          
imageview.setImageBitmap(bitmap);

错误日志 08-14 10:29:44.376:E / AndroidRuntime(2063):java.lang.RuntimeException:传递结果失败ResultInfo {who = null,request = 1,result = -1,data = Intent {

DAT =文件:///storage/emulated/0/Download/dHkGLr7F6v25DRUu7Vaq3GvXUW2c0gbxzs05WmmQ8GwMQAN5U8wb-LUJnTCt6IIYjww6gqJ9GT-ID_bxyjtRDdMav8DTnGhpxBV6Kx​​KAEyjYBMsLvzkcv8M0OMfGwbn6yRnCAxdJZeFqi5BbbGzlTiTU_ukeAt0RbERJHdyAie-Dm7IuRg=w350-h350-nc.png}}

to activity {com.example.uploadtest / com.example.uploadtest.MainActivity}:java.lang.NullPointerException

0 个答案:

没有答案