概述
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常用方法所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复