Android查漏补缺(5)ContentProvider和ContentResolver

 ①

ContentProvider相当于web服务器,manifest里面的authorities指定webserver域名,



//上述manifest配置的authority表示此provider的uri的authority部分是config
//因此可以通过content://config/访问此provider

uri介绍,url是一种典型的uri,content的uri包含如下三部分

protocol:authory:word

content://config/table1
//协议是content://
//authority是config
//word是table1,表示此provider的表table1

contentResolver,contentResolver相当于httpclient,可以用来访问contentprovider

//java代码访问contentprovider
Uri uri=Uri.parse("content://config/table1");
context.getContextResolver().insert(uri,values);

//命令行访问contentprovider
content query --uri content://config/table1

你可能感兴趣的:(基础查漏补缺,android,开发语言)