我是靠谱客的博主 唠叨酸奶,这篇文章主要介绍Uri常用方法,现在分享给大家,希望可以做个参考。

Uri uri = Uri.parse("content://com.example.diarycontentprovider/diaries/1");
List<String> list = uri.getPathSegments();
for(int i=0;i<list.size();i++)
System.out.print(list.get(i));
System.out.println();

String path = uri.getEncodedPath();
System.out.println(path);

path = uri.getLastPathSegment();
System.out.println(path);

path = uri.getAuthority();
System.out.println(path);

path = uri.getHost();
System.out.println(path);

path = uri.getScheme();
System.out.println(path);

path = uri.getPath();
System.out.println(path);
[b]
按顺序输出的值[/b]
07-29 07:50:08.158: INFO/System.out(2128): diaries,1
07-29 07:50:08.158: INFO/System.out(2128): /diaries/1
07-29 07:50:08.158: INFO/System.out(2128): 1
07-29 07:50:08.168: INFO/System.out(2128): com.example.diarycontentprovider
07-29 07:50:08.168: INFO/System.out(2128): com.example.diarycontentprovider
07-29 07:50:08.178: INFO/System.out(2128): content
07-29 07:50:08.178: INFO/System.out(2128): /diaries/1

最后

以上就是唠叨酸奶最近收集整理的关于Uri常用方法的全部内容,更多相关Uri常用方法内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(56)

评论列表共有 0 条评论

立即
投稿
返回
顶部