调用相机进行拍照,我们一般会用到如下代码:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, reqCode);//reqCode是返回的code。
但是在有些手机会在protected void onActivityResult(int requestCode, int resultCode, Intent data)里返回的data为空,这时候我们就要想一些办法来解决了。
在我们调用系统相机的时候,我们可以这样做:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
SimpleDateFormat timeStampFormat = new SimpleDateFormat(
"yyyy_MM_dd_HH_mm_ss");
String filename = timeStampFormat.format(new Date());
ContentValues values = new ContentValues();
values.put(Media.TITLE, filename);
android 调用系统相机拍照返回Intent 为空的处理
最新推荐文章于 2022-09-22 22:01:11 发布