美文网首页
ContentResolver: UriMatcher实现匹配内

ContentResolver: UriMatcher实现匹配内

作者: 小叨 | 来源:发表于2017-06-15 16:48 被阅读0次

UriMatcher该类

实现内容匹配时共享信息

.addURI(authority,path,自定义代码):接受3个参数

然后通过

.match(uri);用uri匹配对象对应的代码,通过该方法,判断调用方想访问哪张表

UriMatcher uri = new UriMatcher(UriMatcher.No_MATCH);

查询table表中所有数据

uri.addURI("com.example.app.provider","table",0);

查询table表中的单条数据

uri.addURI("com.example.app.provider","table/#",1);

相关文章

网友评论

      本文标题:ContentResolver: UriMatcher实现匹配内

      本文链接:https://www.haomeiwen.com/subject/dyjeqxtx.html