1.假设在A应用生成了一个aaa.db的数据库
2.在B应用怎么访问呢
public class ReadAXXXDB {
public static int getSouceStatus(Context context,int sourceNumber) {
Uri uri = Uri.parse("content://com.aaa.A/aaa.db");
ContentResolver resolver = context.getContentResolver();
Cursor cursor = resolver.query(uri, null, null, new String[]{"" + Number}, null);
int status = -1;
if (cursor != null) {
for (cursor.moveToFirst(); !(cursor.isAfterLast()); cursor.moveToNext()) {
status = cursor.getInt(cursor.getColumnIndex("status"));
}
} else {
status = 1;
}
return status;
}
}