在活动结果相机意图在三星s4中返回null

Mos*_*t3d 5 camera android android-intent


在此先感谢您的帮助.这是我在创建第一个应用程序时遇到的问题.

我正在制作应用程序,其中用户可以选择从图库或相机拍摄图像,当从图库导入图像时,应用程序正在按需工作,但是当从相机拍摄图像时intent返回null.

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(cameraIntent,YOUR_SELECT_PICTURE_REQUEST_CODE);
Run Code Online (Sandbox Code Playgroud)

Mos*_*t3d 3

<activity
            android:name="com.example.AddPhotoActivity"
            android:label="Add Photo"
             android:configChanges="orientation|screenSize"
            android:screenOrientation="portrait"
          >
Run Code Online (Sandbox Code Playgroud)

通过在清单中添加此内容,我可以存储我的活动的最后状态,然后我的活动不会再次启动,而是从之前的状态恢复,并且相机意图不返回 null

android:configChanges="orientation|screenSize"
Run Code Online (Sandbox Code Playgroud)