List of usage examples for android.support.v4.content CursorLoader CursorLoader
public CursorLoader(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder)
From source file:com.adkdevelopment.earthquakesurvival.ui.MapviewFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { return new CursorLoader(getActivity(), EarthquakeColumns.CONTENT_URI, null, EarthquakeColumns.MAG + " >= ?", new String[] { String.valueOf(Utilities.getMagnitudePrefs(getContext())) }, null); }
From source file:com.dgsd.android.ShiftTracker.Adapter.WeekAdapter.java
public CursorLoader getWeeklyLoader(Context context) { final String sel = "(" + DbField.JULIAN_DAY + " >= ? AND " + DbField.JULIAN_DAY + " < ?) OR (" + DbField.END_JULIAN_DAY + " >= ? AND " + DbField.END_JULIAN_DAY + " < ?)"; final String[] args = new String[] { String.valueOf(mStartingJulianDay), String.valueOf(mStartingJulianDay + 7), String.valueOf(mStartingJulianDay), String.valueOf(mStartingJulianDay + 7) }; final String sort = DbField.JULIAN_DAY + " ASC," + DbField.START_TIME + " ASC, " + DbField.NAME + " ASC"; return new CursorLoader(context, Provider.SHIFTS_URI, DbTable.SHIFTS.getFieldNames(), sel, args, sort); }
From source file:com.piusvelte.wapdroid.ManageData.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { switch (id) { case DATA_LOADER: return new CursorLoader(getActivity(), Networks.CONTENT_URI, args.getStringArray(PROJECTION), args.getString(SELECTION), args.getStringArray(SELECTION_ARGS), STATUS); default:/*from www . j a va 2s. co m*/ return null; } }
From source file:ac.robinson.mediaphone.activity.TemplateBrowserActivity.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { return new CursorLoader(TemplateBrowserActivity.this, NarrativeItem.TEMPLATE_CONTENT_URI, NarrativeItem.PROJECTION_ALL, NarrativeItem.SELECTION_NOT_DELETED, null, NarrativeItem.DEFAULT_SORT_ORDER); }
From source file:com.andrew.apollo.ui.activities.SearchActivity.java
/** * {@inheritDoc}// w w w. j a v a2 s . c o m */ @Override public Loader<Cursor> onCreateLoader(final int id, final Bundle args) { final Uri uri = Uri.parse("content://media/external/audio/search/fancy/" + Uri.encode(mFilterString)); final String[] projection = new String[] { BaseColumns._ID, MediaStore.Audio.Media.MIME_TYPE, MediaStore.Audio.Artists.ARTIST, MediaStore.Audio.Albums.ALBUM, MediaStore.Audio.Media.TITLE, "data1", "data2" }; return new CursorLoader(this, uri, projection, null, null, null); }
From source file:com.example.amit.tellymoviebuzzz.DetailFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { Log.v(LOG_TAG, "In onCreateLoader"); // Intent intent = getActivity().getIntent(); // if (intent == null) { // return null; // }//from www . j a va 2 s . c o m String movieid = args.getString("movieid"); String sele = MovieContract.MovieImdbEntry.TABLE_NAME + "." + MovieContract.MovieImdbEntry.COLUMN_TMDB_ID + " = ?"; // Now create and return a CursorLoader that will take care of // creating a Cursor for the data being displayed. return new CursorLoader(getActivity(), MovieContract.MovieImdbEntry.CONTENT_URI, DETAIL_COLUMNS, sele, new String[] { movieid }, null); }
From source file:com.example.tejeswar.ram.MainActivityFragment.java
@Override public Loader<Cursor> onCreateLoader(int i, Bundle bundle) { // 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); }
From source file:com.laer.easycast.ImagePane.java
public String getRealPathFromURI(Uri contentUri) { String[] proj = { MediaStore.Images.Media.DATA }; //This method was deprecated in API level 11 //Cursor cursor = managedQuery(contentUri, proj, null, null, null); CursorLoader cursorLoader = new CursorLoader(getActivity(), contentUri, proj, null, null, null); Cursor cursor = cursorLoader.loadInBackground(); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst();// w w w . j ava2 s .com return cursor.getString(column_index); }
From source file:com.arcusapp.soundbox.data.MediaProvider.java
public Song getSongFromID(String songID) { Song song;/*from www . j a v a 2 s .c o m*/ List<String> values = new ArrayList<String>(); String[] projection = { MediaStore.Audio.Media._ID, MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ALBUM, MediaStore.Audio.Media.DATA }; String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0 AND " + MediaStore.Audio.Media._ID + " = ?"; String[] selectionArgs = new String[] { songID }; CursorLoader cl = new CursorLoader(SoundBoxApplication.getContext(), defaultDirectoryUri, projection, selection, selectionArgs, null); myCursor = cl.loadInBackground(); try { myCursor.moveToNext(); for (int i = 0; i < myCursor.getColumnCount(); i++) values.add(myCursor.getString(i)); if (values.size() > 0) { song = new Song(values.get(0), values.get(1), values.get(2), values.get(3), values.get(4)); } else { song = new Song(); } } catch (Exception ignored) { song = new Song(); } myCursor.close(); return song; }
From source file:com.battlelancer.seriesguide.ui.dialogs.ListsDialogFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { // filter for this item, but keep other lists String itemId = args.getString("itemid"); int itemType = args.getInt("itemtype"); return new CursorLoader(getActivity(), Lists.buildListsWithListItemUri(ListItems.generateListItemIdWildcard(itemId, itemType)), ListsQuery.PROJECTION, null, null, null); }