你好,我想在画廊中打开图片,以下是我的代码
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);
}
});
但是它显示空指针异常
Uri.parse(obj.getImageUrl() returns below string
/mnt/sdcard/Pictures/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 }