【发布时间】:2015-04-16 01:49:14
【问题描述】:
我已经为此苦苦挣扎了一整天 :-( 我目前的方法看起来像这样
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/image.jpg");
imagePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/image.jpg";
startActivityForResult(IntentUtils.dispatchTakePictureIntent(getActivity(), file), REQUEST_IMAGE_CAPTURE);
之后我做了一些不重要的事情来正确显示位图,然后用这个方法显示它
placeImageView.setImageBitmap(rotatedBitmap);
*EDIT 这就是我创建意图的方式
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// Ensure that there's a camera activity to handle the intent
if (takePictureIntent.resolveActivity(context.getPackageManager()) != null) {
if (file != null) {
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(file));
return takePictureIntent;
}
}
return null;
}
到目前为止有效。
但是当我在下一个活动中使用这个imagePath 时,位图不会加载。我之前已经用这个文件路径尝试了很多东西,现在我只是对所有可能的处理方法感到不知所措......
【问题讨论】:
-
您遇到什么错误?您是否在第二个活动中定义 imagePath?
-
发布你如何在“nextactivity”中加载位图?
-
好吧我的错误是不同的,我得到了一个空指针,因为我没有图像视图的尺寸并试图用它做一些计算
标签: android android-camera android-camera-intent android-bitmap