目前我正在使用getContentResolver().query()/ managedQuery()来获取光标以从图库应用程序中检索图像.因为我正在使用的API部分弃用,所以我想将CursorLoader与LoaderManager一起使用.
/**
* Creates a cursor to access the content defined by the image uri for API
* version 11 and newer.
*
* @return The created cursor.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private Cursor createCursorHoneycomb() {
String[] projection = {
MediaStore.Images.Media.DATA
};
Cursor cursor = getContentResolver().query(imageUri, projection, null, null, null);
return cursor;
}
/**
* Creates a cursor to access the content defined by the image uri from API
* version 8 to 10.
*
* @return The created cursor.
*/ …Run Code Online (Sandbox Code Playgroud) android android-cursor android-loadermanager android-cursorloader android-cursoradapter
android ×1