嗨,我想在图库中打开图片,下面是我的代码
mImageView.setImageBitmap(AppUtil.getBitmapFromFile(obj.getImageUrl(), 200, 200));
mImageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(obj.getImageUrl()), "image/*");
startActivity(intent);
}
});
但它显示 NullPointerException
Uri.parse(obj.getImageUrl() returns below string
/mnt/sdcard/图片/app_images/pro20130429_170323_-1793725321.tmp
更新:现在我尝试
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("file://sdcard/Pictures/app_images/pro20130429_170323_-1793725321.tmp")));
并收到一个错误
05-03 16:40:18.460: E/AndroidRuntime(4764): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=file://sdcard/Pictures/app_images/pro20130429_170323_-1793725321.tmp }