如何通过URI来的意图是什么? [英] How to pass a URI to an intent?
本文介绍了如何通过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来的意图是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文