UriMatcher用法
来源:互联网 发布:淘宝推广预算表 编辑:程序博客网 时间:2024/06/14 08:50
UriMatcher类用于匹配Uri,它的用法如下:
首先第一步把你需要匹配Uri路径全部给注册上,如下:
//常量UriMatcher.NO_MATCH表示不匹配任何路径的返回码
UriMatcher
//如果match()方法匹配content://cn.xxt.provider.personprovider/person路径,返回匹配码为1
sMatcher.addURI(“cn.xxt.provider.personprovider”, “person”, 1);//添加需要匹配uri,如果匹配就会返回匹配码
//如果match()方法匹配content://cn.xxt.provider.personprovider/person/230路径,返回匹配码为2
sMatcher.addURI(“cn.xxt.provider.personprovider”, “person/#”, 2);//#号为通配符
switch (sMatcher.match(Uri.parse("content://cn.xxt.provider.personprovider/person/10"))) {
}
注册完需要匹配的Uri后,就可以使用sMatcher.match(uri)方法对输入的Uri进行匹配,如果匹配就返回匹配码,匹配码是调用addURI()方法传入的第三个参数,假设匹配content://cn.xxt.provider.personprovider/person路径,返回的匹配码为1
- UriMatcher用法
- UriMatcher的用法
- UriMatcher
- Content Provider 中 UriMatcher的用法
- UriMatcher理解
- Android -UriMatcher,ContentUris
- Uri、UriMatcher、ContentUris详解
- Uri、UriMatcher、ContentUris详解
- UriMatcher类使用介绍
- UriMatcher类使用介绍
- Uri、UriMatcher、ContentUris详解
- UriMatcher类使用介绍
- UriMatcher类的简介
- 【Content Provider】UriMatcher类
- UriMatcher类使用介绍
- UriMatcher类使用介绍
- UriMatcher类使用介绍
- Uri、UriMatcher、ContentUris
- 前端面试 JS 篇
- BZOJ2127 happiness-最小割
- 数组和集合
- EasyBolg项目中遇到的问题
- cocos2d js 安卓web情况下显示模糊的问题
- UriMatcher用法
- 数字三角形(动态规划)
- weblogic 启动过程->jdk更改和jvm的调节
- mysql-5.7.18-winx64安装说明
- java学习笔记(二十七)设计模式
- 设置ckeditor为只读
- 1102.Invert a Binary Tree (25)[树的遍历]
- jQuery UI Autocomplete插件 事件API
- 【LeetCode】22. Generate Parentheses