问题描述
我已经看到了很多关于这个帖子,似乎像下面的code应该工作。我已经创建了一个SD卡的图像,并把它添加到仿真器(和正常工作)。
I have seen a lot of posts about this, and it seems like the code below should work. I have created an SD Card image and added it to the emulator (and that works fine).
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
//intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent, 1);
它推出并允许用户选择图像,但是当我点击图像,一切都退出和仿真器返回到主屏幕,不回我的应用程序。我onActivityResult永远不会被调用无论是。
It does launch and allow selection of images, but when I click on an image, everything exits and the emulator returns to the home screen, not the back to my app. My onActivityResult is never called either.
我在想什么?
推荐答案
我发现我的问题。我是从一个子活动启动画廊和子活动的意图有标志FLAG_ACTIVITY_NO_HISTORY其中$ P $无法进入该活动pvented回电。
I found my issue. I was launching the gallery from a sub-activity and that sub activity Intent had the flag FLAG_ACTIVITY_NO_HISTORY which prevented the call back from going to that activity.
感谢。
这篇关于从画廊挑选图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!