2012-06-22 17 views
0

我想显示图像通过相机在图像中捕获在我的7英寸平板电脑中查看3.2。当我捕捉图像和控制返回到我的活动图像不显示在图像视图。 但同样的事情在智能手机上正常工作。我的7英寸平板电脑的纵向视图中的Imageview中没有显示相机捕获图像

我也尝试用android:configChanges =“keyboardHidden | orientation”在该活动的清单中,但仍存在问题。

如果我通过在landsscape中保留平板电脑捕获图像,它工作正常,并显示图像。

我通话摄像头意图如下

我正在上7寸三星平板GT-P6200的版本3.2我的应用程序。

相机意图我叫如下

      Intent cameraIntent = new Intent(); 


     cameraIntent 
       .setAction(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
     startActivityForResult(cameraIntent, PICTURE_FROM_CAMERA); 

请帮我出这个问题的

我的活动结果mehode

公共无效onActivityResult(INT requestCode,INT发送resultCode,Intent数据传输){

if (resultCode == RESULT_OK) { 
     if (requestCode == PICTURE_FROM_CAMERA) { 

      Bitmap bitmap = (Bitmap) data.getExtras().get("data"); 

      photoView.setImageBitmap(bitmap); 

     } 
    } 
} 

回答

0

尝试旋转设备以Landscape作为Med iaStore捕捉仅适用于横向模式。

0

这是一些标签中的常见问题,对于此问题,您可以尝试以下代码。这个对我有用。

try { 
     File f = new File(SD_CARD_IMAGE_PATH); 
     ExifInterface exif = new ExifInterface(f.getPath()); 
     int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); 

     int angle = 0; 

     if (orientation == ExifInterface.ORIENTATION_ROTATE_90) { 
      angle = 90; 
     } 
     else if (orientation == ExifInterface.ORIENTATION_ROTATE_180) { 
      angle = 180; 
     } 
     else if (orientation == ExifInterface.ORIENTATION_ROTATE_270) { 
      angle = 270; 
     } 

     Matrix mat = new Matrix(); 
     mat.postRotate(angle); 

     Bitmap bmp = BitmapFactory.decodeStream(new FileInputStream(f), null, null); 
     Bitmap correctBmp = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), mat, true);     
    } 
    catch (IOException e) { 
     Log.w("TAG", "-- Error in setting image"); 
    } 
    catch(OutOfMemoryError oom) { 
     Log.w("TAG", "-- OOM Error in setting image"); 
    } 

但是我应该用其他形式吗?

相关问题