Esempio n. 1
1
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mDbHelper = new NotesDbAdapter(this);
    mDbHelper.open();

    setContentView(R.layout.note_edit);
    setTitle(R.string.edit_note);

    mTitleText = (EditText) findViewById(R.id.title);
    mBodyText = (EditText) findViewById(R.id.body);

    Button confirmButton = (Button) findViewById(R.id.confirm);

    mRowId =
        (savedInstanceState == null)
            ? null
            : (Long) savedInstanceState.getSerializable(NotesDbAdapter.KEY_ROWID);
    if (mRowId == null) {
      Bundle extras = getIntent().getExtras();
      mRowId = extras != null ? extras.getLong(NotesDbAdapter.KEY_ROWID) : null;
    }

    populateFields();

    confirmButton.setOnClickListener(
        new View.OnClickListener() {

          public void onClick(View view) {
            setResult(RESULT_OK);
            finish();
          }
        });
  }
  public void onResume() {
    super.onResume();
    Log.d(TAG, "onResume()");

    Intent startingIntent = this.getIntent();
    selectedImage = startingIntent.getStringExtra("selected");
    Log.d(TAG, "selectedImage: " + selectedImage);
    oriTitle = startingIntent.getStringExtra("oriTitle");
    croppedTitle = startingIntent.getStringExtra("croppedTitle");
    annotated = startingIntent.getBooleanExtra("annotated", false);
    timestamps = startingIntent.getBundleExtra("timestamps");
    imageType = startingIntent.getStringExtra("img_type");
    Log.d(TAG, "annotated: " + annotated);
    Log.d(TAG, "nTs: " + timestamps.getLong("tsNot") + ", ts: " + timestamps.getLong("ts"));
    if (annotated) {
      this.bubbleTexts = startingIntent.getStringArrayListExtra("texts");
      this.bubbleTypes = startingIntent.getIntegerArrayListExtra("types");
      Log.d(TAG, "bubbleTexts: " + bubbleTexts.size());
      imageType = "annotated";
    }

    if (yourSelectedImage != null)
      if (yourSelectedImage.isRecycled()) yourSelectedImage.prepareToDraw();
    if (imageWithBubbles != null)
      if (imageWithBubbles.isRecycled()) imageWithBubbles.prepareToDraw();

    new WorkerTask().execute(Uri.parse(selectedImage));
  }
 @Override
 public Loader<List<ParcelableStatus>> newLoaderInstance(
     final Context context, final Bundle args) {
   if (args == null) return null;
   final long accountId = args.getLong(EXTRA_ACCOUNT_ID, -1);
   final String screenName = args.getString(EXTRA_SCREEN_NAME);
   final long statusId = args.getLong(EXTRA_STATUS_ID, -1);
   if (accountId <= 0 || statusId <= 0 || screenName == null) return null;
   final long maxId = args.getLong(EXTRA_MAX_ID, -1);
   final long sinceId = args.getLong(EXTRA_SINCE_ID, -1);
   final int tabPosition = args.getInt(EXTRA_TAB_POSITION, -1);
   getListAdapter()
       .setMentionsHightlightDisabled(
           objectEquals(getAccountScreenName(getActivity(), accountId), screenName));
   return new StatusRepliesLoader(
       getActivity(),
       accountId,
       screenName,
       statusId,
       maxId,
       sinceId,
       getData(),
       getSavedStatusesFileArgs(),
       tabPosition);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Get variables from intent
    Bundle extras = getIntent().getExtras();
    String title = extras.getString("title");
    String body = extras.getString("body");
    String dest = extras.getString("destination");
    long arrivalTime = extras.getLong("arrival_time");
    long deptTime = extras.getLong("dept_time");

    // Set and launch notification
    Intent intent = new Intent(this, CancelAlarm.class);
    intent.putExtra("destination", dest);
    intent.putExtra("arrival_time", arrivalTime);
    intent.putExtra("dept_time", deptTime);
    intent.putExtra("title", title);
    intent.putExtra("body", body);
    PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);
    Notification n =
        new NotificationCompat.Builder(this)
            .setContentText(body)
            .setContentIntent(pi)
            .setContentTitle(title)
            .setSmallIcon(R.drawable.ic_launcher)
            .setDefaults(Notification.DEFAULT_ALL)
            .build();
    NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    nm.notify(uniqueID, n);

    // Shut up
    finish();
  }
Esempio n. 5
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    db = new FitmaestroDb(this).open();
    program = new Program(db);

    setContentView(R.layout.edit_program);

    mTitleText = (EditText) findViewById(R.id.edit_name);
    mDescText = (EditText) findViewById(R.id.edit_description);

    Button saveButton = (Button) findViewById(R.id.button_save);

    mRowId = savedInstanceState != null ? savedInstanceState.getLong(FitmaestroDb.KEY_ROWID) : null;
    if (mRowId == null) {
      Bundle extras = getIntent().getExtras();
      mRowId = extras != null ? extras.getLong(FitmaestroDb.KEY_ROWID) : null;
    }

    populateFields();

    saveButton.setOnClickListener(
        new View.OnClickListener() {

          public void onClick(View view) {
            setResult(RESULT_OK);
            finish();
          }
        });
  }
Esempio n. 6
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    contentSupport = new ContentFragmentSupport(this);
    detailsEventSupport = new DetailsEventFragmentSupport(this, this);
    detailsTriggerSupport = new DetailsTriggerFragmentSupport(this, this);
    detailsItemSupport = new DetailsItemFragmentSupport(this);
    support = new MainActivitySupport(this, this, this);

    setupTabs();

    // if so, restore graph
    if (savedInstanceState != null) {
      lastShowChart_units = savedInstanceState.getString("lastShowChart_units");
      if (lastShowChart_units != null) {
        lastShowChart_itemid = savedInstanceState.getLong("lastShowChart_itemid");
        lastShowChart_description = savedInstanceState.getString("lastShowChart_description");
        lastShowChart_graphText = savedInstanceState.getString("lastShowChart_graphText");
        showChart(
            lastShowChart_itemid,
            lastShowChart_units,
            lastShowChart_description,
            lastShowChart_graphText);
        prevTabTag = savedInstanceState.getString("prevTabTag");
      }
      lastShowScreen_screen__id = savedInstanceState.getLong("lastShowScreen_screenid", -1);
      if (lastShowScreen_screen__id > -1) {
        final ListView listScreens = (ListView) findViewById(R.id.list_screens);
        listScreens.setVisibility(View.GONE);
        showScreenGraphs(lastShowScreen_screen__id);
      }
    }
  }
Esempio n. 7
0
 public static void writeSerializableStatuses(
     final Object instance,
     final Context context,
     final SynchronizedStateSavedList<ParcelableStatus, Long> data,
     final long last_viewed_id,
     final Bundle args) {
   if (instance == null || context == null || data == null || args == null) return;
   final long account_id = args.getLong(INTENT_KEY_ACCOUNT_ID, -1);
   final long user_id = args.getLong(INTENT_KEY_USER_ID, -1);
   final String screen_name = args.getString(INTENT_KEY_SCREEN_NAME);
   final int items_limit =
       context
           .getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)
           .getInt(PREFERENCE_KEY_DATABASE_ITEM_LIMIT, PREFERENCE_DEFAULT_DATABASE_ITEM_LIMIT);
   try {
     final int size = data.size();
     final SynchronizedStateSavedList<ParcelableStatus, Long> statuses =
         new SynchronizedStateSavedList<ParcelableStatus, Long>(
             data.subList(0, size > items_limit ? items_limit : size));
     if (last_viewed_id > 0) {
       statuses.setState(last_viewed_id);
     }
     final String path =
         SerializationUtil.getSerializationFilePath(
             context, instance.getClass().getSimpleName(), account_id, user_id, screen_name);
     SerializationUtil.write(statuses, path);
   } catch (final IOException e) {
   }
 }
Esempio n. 8
0
 @Override
 public void setArguments(Bundle b) {
   objectName = b.getString("org.taulabs.androidgcs.ObjectName");
   objectID = b.getLong("org.taulabs.androidgcs.ObjectId");
   instID = b.getLong("org.taulabs.androidgcs.InstId");
   updated = b.getBoolean("org.taulabs.androidgcs.updated", false);
 }
 @Override
 protected Loader<List<ParcelableStatus>> onCreateStatusesLoader(
     final Context context, final Bundle args, final boolean fromUser) {
   setRefreshing(true);
   final long accountId = args.getLong(EXTRA_ACCOUNT_ID, -1);
   final long maxId = args.getLong(EXTRA_MAX_ID, -1);
   final long sinceId = args.getLong(EXTRA_SINCE_ID, -1);
   final String query = args.getString(EXTRA_QUERY);
   final int tabPosition = args.getInt(EXTRA_TAB_POSITION, -1);
   final boolean makeGap = args.getBoolean(EXTRA_MAKE_GAP, true);
   final boolean twitterOptimizedSearches =
       mPreferences.getBoolean(KEY_TWITTER_OPTIMIZED_SEARCHES);
   return new TweetSearchLoader(
       getActivity(),
       accountId,
       query,
       sinceId,
       maxId,
       getAdapterData(),
       getSavedStatusesFileArgs(),
       tabPosition,
       fromUser,
       makeGap,
       twitterOptimizedSearches);
 }
  public ProgramGuideItemView(
      Activity activity,
      Fragment fragment,
      final LinearLayout layout,
      Bundle bundle,
      ViewGroup parent) {
    super(activity);
    this.activity = activity;
    this.layout = layout;
    this.viewGroupParent = parent;

    // Create the interface so we can talk to the fragment
    if (activity instanceof FragmentStatusInterface) {
      fragmentStatusInterface = (FragmentStatusInterface) activity;
    }

    fragmentInterface = (ProgramContextMenuInterface) fragment;

    if (bundle != null) {
      hoursToShow = bundle.getInt(Constants.BUNDLE_EPG_HOURS_TO_SHOW, 4);
      tabIndex = bundle.getInt(Constants.BUNDLE_EPG_INDEX, 0);
      startTime = bundle.getLong(Constants.BUNDLE_EPG_START_TIME, 0);
      endTime = bundle.getLong(Constants.BUNDLE_EPG_END_TIME, 0);
    }

    pixelsPerMinute = Utils.getPixelsPerMinute(activity, tabIndex, hoursToShow);
    displayWidthRemaining = displayWidth;
  }
Esempio n. 11
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_new_event);
   newEvent = new EventTracker();
   if (savedInstanceState != null) {
     ((TextView) findViewById(R.id.setStartTime))
         .setText(savedInstanceState.getString("startTime"));
     ((TextView) findViewById(R.id.setEndTime)).setText(savedInstanceState.getString("endTime"));
     ((TextView) findViewById(R.id.setStartDate))
         .setText(savedInstanceState.getString("startDate"));
     ((TextView) findViewById(R.id.setEndDate)).setText(savedInstanceState.getString("endDate"));
     ((EditText) findViewById(R.id.eventName)).setText(savedInstanceState.getString("eventName"));
     startTimeSet = savedInstanceState.getBoolean("startTimeSet");
     endTimeSet = savedInstanceState.getBoolean("endTimeSet");
     startDateSet = savedInstanceState.getBoolean("startDateSet");
     endDateSet = savedInstanceState.getBoolean("endDateSet");
     newEvent.setStartTimeInMillis(savedInstanceState.getLong("eStartTime"));
     newEvent.setEndTimeInMillis(savedInstanceState.getLong("eEndTime"));
   } else {
     startTimeSet = false;
     endTimeSet = false;
     startDateSet = false;
     endDateSet = false;
   }
 }
Esempio n. 12
0
    @Override
    protected void onPostExecute(Bundle result) {
      if (!handleRequestResult(result, REQUEST_REMOVE_FRIEND, result.getLong(RESULT_REQUESTED_ID)))
        return;

      ((OnRequestRemoveFriendCompleteListener) mLocalListeners.get(REQUEST_REMOVE_FRIEND))
          .onRequestRemoveFriendComplete(getID(), "" + result.getLong(RESULT_REQUESTED_ID));
    }
Esempio n. 13
0
 @Override
 public void onFinishEditDialog(Bundle args) {
   Long parentId;
   if ((parentId = args.getLong("parentId")) == 0L) parentId = null;
   mCategory = new Category(args.getLong("catId"), args.getString("result"), parentId);
   getSupportFragmentManager()
       .beginTransaction()
       .add(DbWriteFragment.newInstance(false), "SAVE_TASK")
       .commit();
 }
 @Override
 public CursorSupportUsersLoader onCreateUsersLoader(
     final Context context, final Bundle args, boolean fromUser) {
   if (args == null) return null;
   final long account_id = args.getLong(EXTRA_ACCOUNT_ID, -1);
   final long user_id = args.getLong(EXTRA_USER_ID, -1);
   final String screen_name = args.getString(EXTRA_SCREEN_NAME);
   return new UserFollowersLoader(
       context, account_id, user_id, screen_name, getNextCursor(), getData(), fromUser);
 }
Esempio n. 15
0
 public Movie(Bundle bundle) {
   this(
       bundle.getLong(KEY_ID),
       bundle.getString(KEY_TITLE),
       bundle.getString(KEY_OVERVIEW),
       bundle.getString(KEY_POSTER_PATH),
       bundle.getDouble(KEY_VOTE_AVERAGE),
       bundle.getLong(KEY_VOTE_COUNT),
       bundle.getString(KEY_RELEASE_DATE));
 }
Esempio n. 16
0
  /**
   * Restore game state if our process is being relaunched
   *
   * @param icicle a Bundle containing the game state
   */
  public void restoreState(Bundle icicle) {
    setMode(PAUSE);

    mAppleList = coordArrayToArrayList(icicle.getIntArray("mAppleList"));
    mDirection = icicle.getInt("mDirection");
    mNextDirection = icicle.getInt("mNextDirection");
    mMoveDelay = icicle.getLong("mMoveDelay");
    mScore = icicle.getLong("mScore");
    mSnakeTrail = coordArrayToArrayList(icicle.getIntArray("mSnakeTrail"));
  }
 @Override
 public Loader<List<ParcelableUser>> newLoaderInstance() {
   final Bundle args = getArguments();
   long account_id = -1, max_id = -1;
   if (args != null) {
     account_id = args.getLong(INTENT_KEY_ACCOUNT_ID, -1);
     max_id = args.getLong(INTENT_KEY_MAX_ID, -1);
   }
   return new IncomingFriendshipsLoader(getActivity(), account_id, max_id, getData());
 }
 protected long[] getAccountIds() {
   final Bundle args = getArguments();
   if (args != null && args.getLong(EXTRA_ACCOUNT_ID) > 0) {
     return new long[] {args.getLong(EXTRA_ACCOUNT_ID)};
   }
   final FragmentActivity activity = getActivity();
   if (activity instanceof HomeActivity) {
     return ((HomeActivity) activity).getActivatedAccountIds();
   }
   return Utils.getActivatedAccountIds(getActivity());
 }
 @Override
 protected String[] getSavedStatusesFileArgs() {
   final Bundle args = getArguments();
   if (args == null) return null;
   final long accountId = args.getLong(EXTRA_ACCOUNT_ID, -1);
   final long userId = args.getLong(EXTRA_USER_ID, -1);
   final String screenName = args.getString(EXTRA_SCREEN_NAME);
   return new String[] {
     AUTHORITY_USER_TIMELINE, "account" + accountId, "user" + userId + "name" + screenName
   };
 }
Esempio n. 20
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle args = getArguments();
    listId = args.getLong(ARG_LIST_ID);
    noteId = args.getLong(ARG_ID);
    note = args.getString(ARG_NOTE);
    status = args.getString(ARG_STATUS);

    setHasOptionsMenu(true);
  }
Esempio n. 21
0
    @Override
    protected void onPostExecute(Bundle result) {
      if (!handleRequestResult(
          result, REQUEST_CHECK_IS_FRIEND, result.getLong(RESULT_REQUESTED_ID))) return;

      ((OnCheckIsFriendCompleteListener) mLocalListeners.get(REQUEST_CHECK_IS_FRIEND))
          .onCheckIsFriendComplete(
              getID(),
              "" + result.getLong(RESULT_REQUESTED_ID),
              result.getBoolean(RESULT_IS_FRIEND));
    }
 private void copyQueryParams(Bundle queryParams) {
   if (queryParams != null) {
     mDateFrom = queryParams.getLong("dateFrom", 0);
     mDateTo = queryParams.getLong("dateTo", 0);
     mLoadLimit = queryParams.getInt("limit", 10);
     mFriendUserId = queryParams.getString("friendUserId");
     mLocalFriendId = queryParams.getString("localFriendId");
     mLoadLimit += queryParams.getInt("pageSize", 10);
   } else {
     mLoadLimit += 10;
   }
 }
 @Override
 public Loader<List<ParcelableStatus>> onCreateLoader(int id, Bundle args) {
   final Context context = getActivity();
   final long accountId = args.getLong(EXTRA_ACCOUNT_ID, -1);
   final long maxId = args.getLong(EXTRA_MAX_ID, -1);
   final long sinceId = args.getLong(EXTRA_SINCE_ID, -1);
   final long userId = args.getLong(EXTRA_USER_ID, -1);
   final String screenName = args.getString(EXTRA_SCREEN_NAME);
   final int tabPosition = args.getInt(EXTRA_TAB_POSITION, -1);
   return new MediaTimelineLoader(
       context, accountId, userId, screenName, sinceId, maxId, null, null, tabPosition, true);
 }
Esempio n. 24
0
        @Override
        public void onReceive(Context context, Intent intent) {
          Bundle questObj = intent.getExtras();
          if (intent.getAction().equalsIgnoreCase(Constants.INTENT_FILTER_NEW_QUEST)) {
            if (questObj.getBoolean(Constants.INTENT_EXTRA_SINGLE_QUEST)) {
              int questType = questObj.getInt("type");

              Quest q = new Quest();
              q.setId(questObj.getLong("id"));
              q.setTitle(questObj.getString("title"));
              q.setCredits(questObj.getLong("credits"));
              q.setExperience(questObj.getLong("experience"));

              String expirationTime = questObj.getString("expirationTime");
              if (expirationTime != null && !expirationTime.equals("null")) {
                q.setExpirationTime(expirationTime);
              }

              q.setStatus(Quest.QuestStatus.Accepted);

              if (questType == Quest.QuestType.Distance.ordinal()) {
                q.setType(Quest.QuestType.Distance);

                int distance = questObj.getInt("distance");
                q = new DistanceQuest(q, distance);
              } else if (questType == Quest.QuestType.Capture.ordinal()) {
                q.setType(Quest.QuestType.Capture);

                GamePlace.PlaceType placeType =
                    GamePlace.PlaceType.values()[questObj.getInt("placeType")];
                int placeTypeValue = questObj.getInt("placeTypeValue");
                q = new CaptureQuest(q, placeType, placeTypeValue);
              } else if (questType == Quest.QuestType.Collect.ordinal()) {
                q.setType(Quest.QuestType.Collect);
                Constants.Characteristic characteristic =
                    Constants.Characteristic.values()[questObj.getInt("characteristic")];
                int characteristicAmount = questObj.getInt("characteristicAmount");
                q = new CollectQuest(q, characteristic, characteristicAmount);
              }
              questsAdapter.add(q);
            } else {
              questsAdapter.refreshWith(App.getQuestManager().getQuests());
            }
          } else if (intent.getAction().equalsIgnoreCase(Constants.INTENT_FILTER_QUEST_UPDATE)) {
            Quest q = new Quest();
            q.setProgress(questObj.getInt("progress"));
            q.setStatus(Quest.QuestStatus.values()[questObj.getInt("status")]);
            q.setId(questObj.getLong("questId"));
            questsAdapter.update(q);
          }
          checkEmptyList();
        }
Esempio n. 25
0
 @Override
 public Loader<List<ParcelableUser>> newLoaderInstance() {
   final Bundle args = getArguments();
   if (args != null) {
     final long account_id = args.getLong(INTENT_KEY_ACCOUNT_ID, -1);
     final long max_id = args.getLong(INTENT_KEY_MAX_ID, -1);
     final long user_id = args.getLong(INTENT_KEY_USER_ID, -1);
     final String screen_name = args.getString(INTENT_KEY_SCREEN_NAME);
     return new UserFollowersLoader(
         getActivity(), account_id, user_id, screen_name, max_id, getData());
   }
   return null;
 }
 @Override
 protected String[] getSavedStatusesFileArgs() {
   final Bundle args = getArguments();
   if (args == null) return null;
   final long accountId = args.getLong(EXTRA_ACCOUNT_ID, -1);
   final String screenName = args.getString(EXTRA_SCREEN_NAME);
   final long statusId = args.getLong(EXTRA_STATUS_ID);
   return new String[] {
     AUTHORITY_STATUS_REPLIES,
     "account" + accountId,
     "screen_name" + screenName,
     "status_id" + statusId
   };
 }
  @Override
  protected void onCreate(Bundle saved) {
    super.onCreate(saved);

    assert (getIntent() != null);
    assert (getIntent().getExtras() != null);

    setContentView(R.layout.activity_edit_time_range);

    mStartDate = (TextView) findViewById(R.id.start_date);
    mStartTime = (TextView) findViewById(R.id.start_time);
    mStopDate = (TextView) findViewById(R.id.stop_date);
    mStopTime = (TextView) findViewById(R.id.stop_time);
    mDuration = (EditText) findViewById(R.id.duration);

    // Update date ranges when duration is changed
    mDuration.addTextChangedListener(this);

    // Fill the task spinner from the database
    SimpleCursorAdapter adapter =
        new SimpleCursorAdapter(
            this,
            android.R.layout.simple_spinner_item,
            null,
            new String[] {"name"},
            new int[] {android.R.id.text1},
            0);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    mTaskSpinner = (Spinner) findViewById(R.id.task_spinner);
    mTaskSpinner.setAdapter(adapter);
    mTaskSpinner.setOnItemSelectedListener(this);

    getLoaderManager().initLoader(TASKS_QUERY_ID, null, this);

    mTimeRangeId = getIntent().getExtras().getLong("id");

    // Restore state if available, otherwise query initial time state from database
    if (saved != null) {
      mStart = Util.newCalendar(saved.getLong("start"));
      mStop = saved.containsKey("stop") ? Util.newCalendar(saved.getLong("stop")) : null;
      mTaskId = saved.getLong("task_id");
      taskUpdated();
      timeUpdated(true);
    } else {
      getLoaderManager().initLoader(TIME_QUERY_ID, null, this);
    }
  }
Esempio n. 28
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    if (savedInstanceState != null) {
      DataSource ds = new DataSource(getActivity());
      try {
        ds.open();
      } catch (SQLException e) {
        e.printStackTrace();
      }
      // activeRound = savedInstanceState.getInt("activeRound");
      long tournamentId = savedInstanceState.getLong("tournamentId");
      Log.d("ScoresFragment", "onActivityCreated " + tournamentId + "");
      if (tournamentId != TEMP_ID) {

        Loader loader = new Loader(getActivity().getApplicationContext());
        this.tournament = loader.getTournamentAndRounds(tournamentId);

        if (tournament.getRounds().length > 0) {
          createMatchTable(1);
          roundTextView.setText("Round: " + 1);

        } else {
          Log.d("ScoresFragment", "getRounds = 0");
        }
      } else {
        Log.d("ScoresFragment", "temp id");
      }
    }
  }
Esempio n. 29
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    Util.setPrefTheme(this);
    super.onCreate(savedInstanceState);
    Log.i(LOG_TAG, "initiating adapter");
    mAdapter = new DatabaseAdapter(this);
    mAdapter.open();

    Bundle b = this.getIntent().getExtras();
    if (b != null) {
      mNoteId = b.getLong(DatabaseAdapter.ID_COL, Const.INVALID_LONG);
      Log.i(LOG_TAG, "Got note ID from intent's bundle: " + mNoteId);
    }
    if (mNoteId == Const.INVALID_LONG) {
      Serializable savedState = savedInstanceState.getSerializable(DatabaseAdapter.ID_COL);
      mNoteId =
          savedState == null || !(savedState instanceof Long)
              ? Const.INVALID_LONG
              : (Long) savedState;
      Log.i(LOG_TAG, "Nothing in the intent, and mNoteId in saved instance state is: " + mNoteId);
    }
    this.setContentView(R.layout.view_note);
    // note display is in onResume
    this.displayNoteOrGoUp();
  }
 @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;
 }