【问题标题】:on activity result camera intent return null in samsung s4活动结果相机意图在三星 s4 中返回 null
【发布时间】:2015-11-06 19:37:33
【问题描述】:


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

我正在制作应用程序,其中用户可以选择从图库或相机中获取图像,当从库中导入图像时,该应用程序可以正常工作,但是当从相机中获取图像时,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);

【问题讨论】:

  • this 会帮助你吗?
  • intent 返回null”是什么意思?

标签: android android-intent camera


【解决方案1】:
<activity
            android:name="com.example.AddPhotoActivity"
            android:label="Add Photo"
             android:configChanges="orientation|screenSize"
            android:screenOrientation="portrait"
          >

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

android:configChanges="orientation|screenSize"

【讨论】:

  • 谢谢!经过数小时的搜索,这奏效了。我很想知道为什么。您能否指出我可以在文档中找到更多信息的位置?
猜你喜欢
  • 2018-09-30
  • 1970-01-01
  • 1970-01-01
  • 2014-04-28
  • 2011-10-22
  • 1970-01-01
  • 2016-01-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多