Android的棒棒糖相机问题棒棒糖、相机、问题、Android

2023-09-06 14:26:18 作者:忙着老去

我的Andr​​oid应用程序于所有的Andr​​oid设备工作正常,从2.3版本到4.4。然而,当我更新了我的三星Galaxy S4,以棒棒糖和测试应用程序说,也有功能,如摄像头的几个误区,地图等。

My android application was working fine on all android devices from version 2.3 to 4.4. However, when i updated my Samsung Galaxy S4 to LOLLIPOP and tested the said app, there are a few errors in functionalities such as camera,map etc.

下面是我的应用程序使用本机摄像头使用的code片断:

Below is the code snippet used in my application to utilize the native camera:

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult( requestCode,  resultCode,  data);
   if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK && null != data) 
   {    
      Bitmap camImg = (Bitmap) data.getExtras().get("data");
   }
}

在这里,我得到(位图)data.getExtras()。获得(数据)作为空。是否有此code任何替代方案。任何帮助将是AP preciated。

Here I am getting (Bitmap) data.getExtras().get("data") as null. Is there any alternate solution for this code. Any help would be appreciated.

推荐答案

我有CommonsWare不同意这一点。我使用android.hardware.Camera与我的应用程序,并用三星Galaxy S4运行棒棒糖测试。看来问题是,是的onCreate之前的onActivityResult上运行的三星棒棒糖应用程序时调用。

I would have to disagree with CommonsWare on this one. I am using the android.hardware.Camera with my app and testing with a Samsung Galaxy S4 running Lollipop. It seems the problem is that onCreate is called before onActivityResult when running the app on Samsung Lollipop.

我的建议是在你的应用设置最大目标20(Android 4.4系统),直到三星排序了这一点。这是三星的问题。

My suggestion is to set the max target in your app to 20 (Android 4.4) until Samsung sorts this out. It is a Samsung issue.

 android:maxSdkVersion="20"