从画廊挑选图片

编程入门 行业动态 更新时间:2024-10-17 13:27:26
本文介绍了从画廊挑选图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经看到了很多关于这个帖子,似乎像下面的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.

感谢。

更多推荐

从画廊挑选图片

本文发布于:2023-11-29 20:14:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1647514.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:画廊   图片

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!