use of android.support.v4.content.CursorLoader in project android_packages_apps_Gallery2 by LineageOS.
the class MediaPickerFragment method onCreateLoader.
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle bundle) {
Uri uri = Uri.parse(bundle.getString(LOADER_EXTRA_URI));
String[] projects = bundle.getStringArray(LOADER_EXTRA_PROJECT);
String order = MediaColumns.DATE_ADDED + " DESC";
return new CursorLoader(mContext, uri, projects, null, null, order);
}
use of android.support.v4.content.CursorLoader in project Brion-Learns-OAuth by brione.
the class BloaUserTimelineFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
this.setEmptyText(this.getString(R.string.empty));
// No cursor yet. Will be assigned when the CursorLoader query is complete
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this.getActivity(), android.R.layout.simple_list_item_2, null, App.USER_STATUS_PROJECTION, IDS, 0);
setListAdapter(adapter);
// Set up our cursor loader. It manages the cursors from now on
getLoaderManager().initLoader(App.LIST_LOADER_ID, null, this);
}
use of android.support.v4.content.CursorLoader in project AgentWeb by Justson.
the class AgentWebUtils method getRealPathBelowVersion.
private static String getRealPathBelowVersion(Context context, Uri uri) {
String filePath = null;
LogUtils.i(TAG, "method -> getRealPathBelowVersion " + uri + " path:" + uri.getPath() + " getAuthority:" + uri.getAuthority());
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();
}
if (filePath == null) {
filePath = uri.getPath();
}
return filePath;
}
use of android.support.v4.content.CursorLoader in project Sunshine-Version-2 by udacity.
the class ForecastFragment method onCreateLoader.
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
// This is called when a new Loader needs to be created. This
// fragment only uses one loader, so we don't care about checking the id.
// To only show current and future dates, filter the query to return weather only for
// dates after or including today.
// Sort order: Ascending, by date.
String sortOrder = WeatherContract.WeatherEntry.COLUMN_DATE + " ASC";
String locationSetting = Utility.getPreferredLocation(getActivity());
Uri weatherForLocationUri = WeatherContract.WeatherEntry.buildWeatherLocationWithStartDate(locationSetting, System.currentTimeMillis());
return new CursorLoader(getActivity(), weatherForLocationUri, FORECAST_COLUMNS, null, null, sortOrder);
}
use of android.support.v4.content.CursorLoader in project android-ui-design-pattern by MathieuCalba.
the class FeedItemActivity method onCreateLoader.
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle b) {
final int realId = id - mFeedId * 100 - mCategoryId;
if (realId == LOADER_ID_FEED_LIST) {
if (b != null) {
final int feedId = b.getInt(EXTRA_FEED_ID, -1);
if (feedId != -1) {
final int categoryId = b.getInt(EXTRA_CATEGORY_ID, -1);
Uri uri = null;
if (categoryId == -1) {
uri = YANAContract.ArticleTable.buildUriWithFeedId(feedId);
} else {
uri = YANAContract.ArticleTable.buildUriWithFeedIdAndCategoryId(feedId, categoryId);
}
return new CursorLoader(this, uri, YANAContract.ArticleTable.PROJ_LIST.COLS, null, null, YANAContract.ArticleTable.DEFAULT_SORT);
}
}
}
return null;
}
Aggregations