内容提供者ContentProvider(是应用程序之间共享数据的一种接口机制,可指定需要共享的数据,而其它应用程序可在不知道数据来源,路径的情况下,对共享数据进行查询,添加等操作.通过contentResolver类可访问ContentProvider中共享的数据)
1.创建ContentProvider类:
private static UriMatcher uriMatcher:new UriMatcher(-1);
private static final int success=1; uriMatcher.addURI("com. example. directory"," directory", Success);
public int delete(){
int code=matcher.match(uri);
if (code==success){db.delete(tableName,"-id=?", new string[]{string.valueof(-id));}
2、访问内容提供者
contentResolver r=getContentResolver();