- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我对这个描述有点困惑:
The caller may pass an extra EXTRA_OUTPUT to control where this image will be written. If the EXTRA_OUTPUT is not present, then a small sized image is returned as a Bitmap object in the extra field. This is useful for applications that only need a small image. If the EXTRA_OUTPUT is present, then the full-sized image will be written to the Uri value of EXTRA_OUTPUT.
如果没有 EXTRA_OUTPUT
,它会返回一个“小尺寸图像”吗?
使用 EXTRA_OUTPUT
,它会返回全尺寸图像吗?
“在额外字段中作为位图对象返回”...
在我的 onActivityResult
上,我只是使用 Intent data
作为实际数据。我应该使用 data.getExtra
还是什么?
最佳答案
如果您提供一个 Uri:
Intent action = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
action.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, myUri);
startActivityForResult(action, CAMERA_RESULT);
然后您使用(在对 requestCode 和 resultCode 进行测试之后)检索它:
Bitmap bitmap = BitmapFactory.decodeFile(myUri, options);
另一种情况:
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, CAMERA_RESULT);
然后用以下方法检索它:
Bundle bundle = intent.getExtras();
Bitmap bitmap = (Bitmap) extras.get("data");
关于java - 使用 ACTION_IMAGE_CAPTURE 时返回什么数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17768145/
我有一个简单的 Android 应用程序,它尝试拍照并将其作为包含多部分数据的 HTTP POST 发送到服务器。问题是 Android 的 Intent 行为在某些手机上是不同的。当我运行时 Int
我的应用程序的一个功能包括相机。用户拍照,应用程序显示图像。 我使用 StartActivityForResult 启动一个 ACTION_IMAGE_CAPTURE Intent ,并使用 onAc
几天来我一直在寻找这个问题的解决方案,但我不知道该怎么做:( 我有一个使用 native 相机拍照的应用程序,但问题是,有时,只有在某些设备上,当我拍照并保存并返回时,我的应用程序才会重新启动。 它是
我们正在尝试使用原生相机应用让用户拍摄一张新照片。如果我们省略 EXTRA_OUTPUT extra 并返回小的位图图像,它就可以正常工作。但是,如果我们在启动前对 Intent 进行 putExtr
我正在使用标准相机 Intent 拍照: Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startAc
尝试在 Unity C# 中访问 Android native 相机组件,但无法正确移植 java 代码。我有另一个 intent call 用于共享,但我似乎无法让它工作。 这是我的代码: stat
我正在使用此代码打开相机 Intent : Intent takePicture = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); takePicture.
这个问题在这里已经有了答案: Low picture/image quality when capture from camera (3 个答案) 关闭 3 年前。 我希望在 ImageView 中
我正在拍摄如下照片: activity.startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE), BaseDef.REQU
我试图简单地从手机摄像头获取图像。令人惊讶的是,它返回旋转。我在互联网上搜索了修复方法,并找到了许多使用 ExifInterface 的解决方案,但它只是有时有效。它的方向似乎是随机错误的,因为我只是
我对这个描述有点困惑: The caller may pass an extra EXTRA_OUTPUT to control where this image will be written. I
我遇到了问题:ACTION_IMAGE_CAPTURE Intent 的行为取决于硬件制造商。 我认为,从插入照片库的相机中获取照片的最佳方式必须如下所示 Intent intent = new In
我正在使用以下代码告诉系统我要拍照: Intent intent = new Intent( android.provider.Medi
我想做的是创建一个新文件夹并将相机拍摄的图像保存在该文件夹中。我正在尝试使用以下代码 fragment 实现它: public class DocsAdd extends Activity {
我正在调用相机: Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXT
我正在尝试接收通过 Mediastore.ACTION_IMAGE_CAPTURE Intent 拍摄的图像的 URI,但由于某种原因,默认相机应用程序 (Google+) 在它返回到我的 Activ
我想将额外的数据放入 Intent 相机,这看起来很简单...... 几天前它还可以工作,但是我对代码、avd 和目标版本做了很多更改,但现在它不工作了。 该项目现在的目标版本为 11。 事实上,我的
我正在使用 ACTION_IMAGE_CAPTURE 请求相机应用拍照。根据official doc如果我的应用使用相机功能但不需要它来正常运行,则应在 list 中保留以下内容
默认情况下,相机应用程序完成后我可以获得的图像将是矩形的。我想知道是否有可能让相机应用程序获得方形图像而无需裁剪原始矩形图像。 最佳答案 不,对不起。 首先,ACTION_IMAGE_CAPTURE
在 Android 上执行 ACTION_IMAGE_CATPURE Intent 的最可靠方法是什么?我尝试了多种在网上找到的方法,但没有一种方法适用于所有设备。我的测试设备是 Nexus 6 (A
我是一名优秀的程序员,十分优秀!