android 中选项卡组中的 startActivityForResult 问题
我的应用程序中有 3 个选项卡。其中一个选项卡 (Pitchin
) 需要替换视图,因此我创建了一个扩展 ActivityGroup 的类。
我曾经这样替换视图:
View view = PitchinTab.group.getLocalActivityManager()
.startActivity("Items", new
Intent(Pitchin.this, send.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
.getDecorView();
PitchinTab.group.replaceView(view);
我的问题是,我需要从 PitchIn
类调用内置画廊,为此我已经这样做了:
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"SelectPicture"),SELECT_PICTURE);
并且我正在 OnActivityResult 中处理结果,如下所示:
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == SELECT_PICTURE) {
Uri selectedImageUri = data.getData();
selectedImagePath = getPath(selectedImageUri);
Uri uri = Uri.parse(selectedImagePath);
test.setImageURI(uri);
}
}
}
画廊正在打开,但我无法在我的活动中获取图片。我无法处理 OnActivityResult,问题是由于我使用了 ActivityGroup。
使用ActiviyGroup时如何将结果从图库获取到选项卡?
我找到了一些链接,但我还没有得到正确的解决方案,请帮助我..
提前致谢...
i have a 3 tabs in my app.One tab (Pitchin
) requires replacing of the view, so i created a class that extends ActivityGroup.
i used to replace the view like this:
View view = PitchinTab.group.getLocalActivityManager()
.startActivity("Items", new
Intent(Pitchin.this, send.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
.getDecorView();
PitchinTab.group.replaceView(view);
What my problem is, i need to call built in gallery from PitchIn
class, For this i have done like this:
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"SelectPicture"),SELECT_PICTURE);
And i am handling result in OnActivityResult like this:
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == SELECT_PICTURE) {
Uri selectedImageUri = data.getData();
selectedImagePath = getPath(selectedImageUri);
Uri uri = Uri.parse(selectedImagePath);
test.setImageURI(uri);
}
}
}
Gallery is opening but i cant get picture in my activity.i am unable to handle OnActivityResult,problem is due to i used ActivityGroup.
How to get result from gallery to Tab when using ActiviyGroup?
i find some links but i didnt get right solution yet, Please help me..
Thanks in advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论