Can';t将全尺寸照片保存在Android中

Can';t将全尺寸照片保存在Android中,android,android-camera-intent,Android,Android Camera Intent,读完教程后,我试着像教程中那样做 问题是,在我的OnePlus X上它可以工作。如果我使用三星Galaxy S5或S6等其他手机或任何其他设备,则无法正常工作 pictureActionIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (pictureActionIntent.resolveActivity(getPackageManager()) != null) { File photoFile = null; try

读完教程后,我试着像教程中那样做

问题是,在我的OnePlus X上它可以工作。如果我使用三星Galaxy S5或S6等其他手机或任何其他设备,则无法正常工作

pictureActionIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (pictureActionIntent.resolveActivity(getPackageManager()) != null) {
File photoFile = null;
    try {
        photoFile = createImageFile();
    } catch (IOException ex) {
        e.printStackTrace();
    }
    if (photoFile != null) {
        //pictureActionIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
    }
}
startActivityForResult(pictureActionIntent, CAMERA_REQUEST);
如果删除注释,则活动结果中的
数据
null
。 如果我设置注释,数据(在三星设备上)看起来像:

那么,问题在哪里?我必须改变什么才能使它在每台设备上工作

谢谢你的帮助


亲切的问候

您还需要传递图像URL

   intent.putExtra( MediaStore.EXTRA_OUTPUT, _fileUri);
然后可以使用此文件路径

编辑

private void saveFullImage() { 
  Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  File file = new File(Environment.getExternalStorageDirectory(), "test.jpg");
  outputFileUri = Uri.fromFile(file);
  intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
  startActivityForResult(intent, TAKE_PICTURE);
} 

@Override 
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  if ((requestCode == TAKE_PICTURE) && (resultCode == Activity.RESULT_OK)) {
    // Check if the result includes a thumbnail Bitmap 
    if (data == null) {    
      // TODO Do something with the full image stored 
      // in outputFileUri. Perhaps copying it to the app folder 
    } 
  } 
} 

我想我是在
Uri.fromFile(photoFile)
上这样做的?我不知道它看起来和我一样。是的,就像我写的。如果删除注释,则不会发生任何事情,并且数据为空。如果我在
onActivityResult
中设置注释
data
,则该注释具有值。是否正在创建照片文件路径?该路径上的文件是否存在于设备存储器中?该位置上存储的文件是否为完整大小?所以你可以使用这个文件:)是的,但就在我的OnePlus X上。在其他设备上没有文件。
private void saveFullImage() { 
  Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  File file = new File(Environment.getExternalStorageDirectory(), "test.jpg");
  outputFileUri = Uri.fromFile(file);
  intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
  startActivityForResult(intent, TAKE_PICTURE);
} 

@Override 
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  if ((requestCode == TAKE_PICTURE) && (resultCode == Activity.RESULT_OK)) {
    // Check if the result includes a thumbnail Bitmap 
    if (data == null) {    
      // TODO Do something with the full image stored 
      // in outputFileUri. Perhaps copying it to the app folder 
    } 
  } 
}