简体   繁体   English

显示摄像头意图仅在Android中的Webview中?无法仅获取Camera Intent?android 5+和6+

[英]Display Camera Intent Only In Webview in android?unable to get Camera Intent only?android 5+ and 6+

I followed this or this to upload Images and capture upload Images form gallery or camera to web-view 我按照这个这个上传图像并捕获上传图像从图库或相机到网络视图

I here its working in android 6+ but here I am getting Gallery or Filemanager not camera... 我在这里工作在android 6+但在这里我得到Gallery或Filemanager不是相机...

Can any one suggest me To get Camera Intent only(insted of gallery or filemanager).. To capture and upload in webview.. 任何人都可以建议我只获得Camera Intent(图库或文件管理员)..要在webview中捕获和上传..

I am getting below options 我得到以下选项

在此输入图像描述 I am not getting Camera Intent In webview.. It working fine in browser and Uploading Image but not in web-view please help... 我没有得到相机意图在webview ..它在浏览器和上传图像工作正常但不在网络视图请帮助...

Update 1 更新1

When I click on the Android System I am getting Camera 当我点击Android系统时,我正在获取相机

在此输入图像描述

Is it possible to get that camera directly in web-view.. Please help in android 6+ I am not getting even Android system intent also.. there is no option to choose Camera.... 是否有可能直接在网络视图中获取相机..请帮助在Android 6+我甚至没有得到Android系统意图..没有选择相机选项....

But Same thing is working in browser.. Not in web-view 但同样的事情是在浏览器中工作..不在Web视图中

Update 2 更新2

By using the same in Emulator its showing Camera option only.. But Where as in Real Device Its showing file-manger or Gallery for android 6+ there is no Camera option I tried with Almost all Brands Even Redmi and YU also 通过在模拟器中使用它同样只显示相机选项..但在真实设备中它显示文件管理器或Android 6+的图库没有相机选项我试过几乎所有品牌甚至Redmi和YU也

Here I tried with Custom Camera But over there I am unable to Upload Image Please Help 在这里我尝试使用自定义相机但在那里我无法上传图片请帮助

Plese any one suggest me Regarding this 任何人建议我这个

This is how you can take pictures using camera 这是你如何使用相机拍照

Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);

you will need this permission ALWAYS 你总是需要这个许可

<uses-feature android:name="android.hardware.camera"
              android:required="true" />

To get the captured camera's thumbnail 获取捕获的相机缩略图

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
     Bundle extras = data.getExtras();
     Bitmap imageBitmap = (Bitmap) extras.get("data");
     mImageView.setImageBitmap(imageBitmap);
  }
}

The Android Camera application encodes the photo in the return Intent delivered to onActivityResult() as a small Bitmap in the extras, under the key "data". Android Camera应用程序将返回Intent中的照片编码为onActivityResult(),作为附加内容中的一个小位图,位于关键字“data”下。 The following code retrieves this image and displays it in an ImageView . 以下代码检索此图像并将其显示在ImageView中

Required link: Android documentation 必填链接: Android文档

I hope it helps. 我希望它有所帮助。 Cheers! 干杯!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM