コード例 #1
0
 @Override
 public Loader<Cursor> onCreateLoader(int id, Bundle args) {
   Log.v(LOG_TAG, "In onCreateLoader");
   long mid = args.getLong(sMovieIdKey);
   if (mid > 0L)
     switch (id) {
       case 0:
         return new CursorLoader(
             getActivity(), MovieContract.MovieEntry.buildUri(mid), null, null, null, null);
       case 1:
         return new CursorLoader(
             getActivity(),
             MovieContract.MovieEntry.buildUriTrailers(mid),
             null,
             null,
             null,
             null);
       case 2:
         return new CursorLoader(
             getActivity(), MovieContract.MovieEntry.buildUriReviews(mid), null, null, null, null);
       default:
         return null;
     }
   else return null;
 }
コード例 #2
0
 private void updateReviewDataInternal(Serializable results) {
   String selection = MovieContract.MovieEntry.COLUMN_MOVIE_ID + "=?";
   String[] selectionArgs = new String[] {mMovieId.toString()};
   ContentValues cv = new ContentValues();
   cv.put(MovieContract.MovieEntry.COLUMN_MOVIE_REVIEWS, SerializationUtils.serialize(results));
   getActivity()
       .getContentResolver()
       .update(MovieContract.MovieEntry.buildUriReviews(mMovieId), cv, selection, selectionArgs);
 }