Search in sources :

Example 36 with CursorLoader

use of android.support.v4.content.CursorLoader in project apps-android-wikipedia by wikimedia.

the class RecentSearchesFragment method onCreateLoader.

@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
    Uri uri = SearchHistoryContract.Query.URI;
    final String[] projection = null;
    final String selection = null;
    final String[] selectionArgs = null;
    String order = SearchHistoryContract.Query.ORDER_MRU;
    return new CursorLoader(getContext(), uri, projection, selection, selectionArgs, order);
}
Also used : CursorLoader(android.support.v4.content.CursorLoader) Uri(android.net.Uri)

Example 37 with CursorLoader

use of android.support.v4.content.CursorLoader in project YhLibraryForAndroid by android-coco.

the class AgentWebUtils method getRealPathBelowVersion.

private static String getRealPathBelowVersion(Context context, Uri uri) {
    String filePath = null;
    String[] projection = { MediaStore.Images.Media.DATA };
    CursorLoader loader = new CursorLoader(context, uri, projection, null, null, null);
    Cursor cursor = loader.loadInBackground();
    if (cursor != null) {
        cursor.moveToFirst();
        filePath = cursor.getString(cursor.getColumnIndex(projection[0]));
        cursor.close();
    }
    return filePath;
}
Also used : CursorLoader(android.support.v4.content.CursorLoader) SpannableString(android.text.SpannableString) Cursor(android.database.Cursor)

Aggregations

CursorLoader (android.support.v4.content.CursorLoader)36 Uri (android.net.Uri)18 Cursor (android.database.Cursor)13 Test (org.junit.Test)8 SmallTest (android.test.suitebuilder.annotation.SmallTest)6 SpannableString (android.text.SpannableString)5 TagMetadataTest (com.google.samples.apps.iosched.model.TagMetadataTest)5 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 Context (android.content.Context)4 Matchers.anyString (org.mockito.Matchers.anyString)4 SettingsMockContext (com.google.samples.apps.iosched.testutils.SettingsMockContext)3 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)2 ArrayList (java.util.ArrayList)2 SuppressLint (android.annotation.SuppressLint)1 SharedPreferences (android.content.SharedPreferences)1 Bundle (android.os.Bundle)1 Loader (android.support.v4.content.Loader)1 SimpleCursorAdapter (android.support.v4.widget.SimpleCursorAdapter)1 CloudEntry (com.amaze.filemanager.database.models.CloudEntry)1 CloudPluginException (com.amaze.filemanager.exceptions.CloudPluginException)1