在Samsung Note 2 for Android中,相机无法在纵向屏幕模式下工作

时间:2013-05-02 06:37:24

标签: android

    // calling hardware camera 
      Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
  cameraIntent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 
output = Uri.fromFile(new File(Environment.getExternalStorageDirectory(),
                    "my_app_" + String.valueOf(System.currentTimeMillis()) + ".jpg"));

cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, output);

startActivityForResult(cameraIntent, CAMERA_REQUEST_CODE);

  //  OnActivityresult :

   // Store the  image in a file to upload to server
      bitmap =decodeUri(output);

    File file = new File(Environment.getExternalStorageDirectory() + "/myimage.jpeg");
     FileOutputStream fOut = new FileOutputStream(file);
     bitmap = (Bitmap) data.getExtras().get("data");
     bitmap.compress(Bitmap.CompressFormat.JPEG, 70, fOut);

    //imageview img;    
     img.setImageBitmap(bitmap);

0 个答案:

没有答案