解决方案 »

  1.   

    第一次拍照上传文件 空指针 报错在
     Cursor cursor = managedQuery(photoUri, pojo, null, null,null);    
    photoUrl空指针报错后再点拍照上传,就不报错了 
      

  2.   

    我也遇到差不多的问题 ,    photoUri = this.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);   这里拿到的photoUri 就是空的 ,请问lz解决了吗
      

  3.   

    是在别的手机上也会出现这种问题吗? 个人认为这个可能是camera的问题
    你可以试一下下面这种方式,把照片存放的文件发过去,然后返回后直接用
    private void dispatchTakePictureIntent() {
        Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        // Ensure that there's a camera activity to handle the intent
        if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
            // Create the File where the photo should go
            File photoFile = null;
            try {
                photoFile = createImageFile();
            } catch (IOException ex) {
                // Error occurred while creating the File
                ...
            }
            // Continue only if the File was successfully created
            if (photoFile != null) {
                takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
                        Uri.fromFile(photoFile));
                startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
            }
        }
    }