use of android.support.v4.content.CursorLoader in project chuck by jgilfelt.
the class TransactionActivity method onCreateLoader.
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
CursorLoader loader = new CursorLoader(this);
loader.setUri(ContentUris.withAppendedId(ChuckContentProvider.TRANSACTION_URI, transactionId));
return loader;
}
use of android.support.v4.content.CursorLoader in project BBS-Android by bdpqchen.
the class PathUtil method getRealPathFromURI.
public static String getRealPathFromURI(Context context, Uri contentUri) {
String[] proj = { MediaStore.Images.Media.DATA };
CursorLoader loader = new CursorLoader(context, contentUri, proj, null, null, null);
Cursor cursor = loader.loadInBackground();
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
String result = cursor.getString(column_index);
cursor.close();
// LogUtil.dd("realpath ", result);
return result;
}
use of android.support.v4.content.CursorLoader in project WordPress-Android by wordpress-mobile.
the class MediaBrowserActivity method getRealPathFromContentURI.
private String getRealPathFromContentURI(Uri contentUri) {
if (contentUri == null)
return null;
String[] proj = { android.provider.MediaStore.Images.Media.DATA };
CursorLoader loader = new CursorLoader(this, contentUri, proj, null, null, null);
Cursor cursor = loader.loadInBackground();
if (cursor == null)
return null;
int column_index = cursor.getColumnIndex(proj[0]);
if (column_index == -1) {
cursor.close();
return null;
}
String path;
if (cursor.moveToFirst()) {
path = cursor.getString(column_index);
} else {
path = null;
}
cursor.close();
return path;
}
use of android.support.v4.content.CursorLoader in project WordPress-Android by wordpress-mobile.
the class MeFragment method getRealPathFromContentURI.
private String getRealPathFromContentURI(Uri contentUri) {
if (contentUri == null)
return null;
String[] proj = { MediaStore.Images.Media.DATA };
CursorLoader loader = new CursorLoader(getActivity(), contentUri, proj, null, null, null);
Cursor cursor = loader.loadInBackground();
if (cursor == null)
return null;
int column_index = cursor.getColumnIndex(MediaStore.Images.Media.DATA);
if (column_index == -1) {
cursor.close();
return null;
}
String path;
if (cursor.moveToFirst()) {
path = cursor.getString(column_index);
} else {
path = null;
}
cursor.close();
return path;
}
use of android.support.v4.content.CursorLoader in project robolectric by robolectric.
the class ShadowCursorLoaderTest method testSetters.
@Test
public void testSetters() {
Uri uri = Uri.parse("http://robolectric.org");
String[] projection = new String[] { "_id", "TestColumn" };
String selection = "_id = ?";
String[] selectionArgs = new String[] { "5" };
String sortOrder = "_id";
CursorLoader cursorLoader = new CursorLoader(RuntimeEnvironment.application);
cursorLoader.setUri(uri);
cursorLoader.setProjection(projection);
cursorLoader.setSelection(selection);
cursorLoader.setSelectionArgs(selectionArgs);
cursorLoader.setSortOrder(sortOrder);
assertThat(cursorLoader.getUri()).isEqualTo(uri);
assertThat(cursorLoader.getProjection()).isEqualTo(projection);
assertThat(cursorLoader.getSelection()).isEqualTo(selection);
assertThat(cursorLoader.getSelectionArgs()).isEqualTo(selectionArgs);
assertThat(cursorLoader.getSortOrder()).isEqualTo(sortOrder);
}
Aggregations