如何通过URI来的意图是什么?

编程入门 行业动态 更新时间:2024-10-07 17:31:44
本文介绍了如何通过URI来的意图是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想要一个URI的对象传递到我的意图,以使用URI 在另一项活动...

I'm trying to pass a URI-Object to my Intent in order to use that URI in another activity...

我如何通过一个URI?

How do I pass a URI ?

private Uri imageUri; .... Intent intent = new Intent(this, GoogleActivity.class); intent.putExtra("imageUri", imageUri); startActivity(intent); this.finish();

我如何在我的其他活动,现在用这个URI?

How do I use now this URI in my other activity?

imageUri = extras.getString("imageUri"); // I know thats wrong ...

感谢你们

推荐答案

可以存储URI作为字符串

you can store the uri as string

intent.putExtra("imageUri", imageUri.toString());

然后就转换回字符串像这样

and then just convert back to string like this

Uri myUri = Uri.parse(extras.getString("imageUri"));

更多推荐

如何通过URI来的意图是什么?

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

发布评论

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

>www.elefans.com

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