Android内容提供者

时间:2024-12-01 16:41:23

一、ContentProvider

实现跨程序共享数据

 

创建内容提供者:extends ContentProvider类 

访问数据

Uri uri =Uri.parse("uri路径")

查询数据

ContentResolver resolver = context.getContentResolver();

Cursor cur = resolver.query(Uri,projection,selection,selectionArgs,sortOrder)

while(cursor.moveToNext()){

String add = cursor.getString(0)}

cursor.close()