コード例 #1
0
  // utility method used to start sub activity
  private void startApplicationDetailsActivity() {
    // start new fragment to display extended information
    Bundle args = new Bundle();
    args.putString(InstalledAppDetails.ARG_PACKAGE_NAME, mCurrentPkgName);

    PreferenceActivity pa = (PreferenceActivity) getActivity();
    pa.startPreferencePanel(
        InstalledAppDetails.class.getName(),
        args,
        R.string.application_info_label,
        null,
        this,
        INSTALLED_APP_DETAILS);
  }
 public boolean startFragment(
     Fragment caller, String fragmentClass, int requestCode, Bundle extras) {
   if (getActivity() instanceof PreferenceActivity) {
     PreferenceActivity preferenceActivity = (PreferenceActivity) getActivity();
     preferenceActivity.startPreferencePanel(
         fragmentClass, extras, R.string.lock_settings_picker_title, null, caller, requestCode);
     return true;
   } else {
     Log.w(
         TAG,
         "Parent isn't PreferenceActivity, thus there's no way to launch the "
             + "given Fragment (name: "
             + fragmentClass
             + ", requestCode: "
             + requestCode
             + ")");
     return false;
   }
 }
コード例 #3
0
  // utility method used to start sub activity
  private void startServiceDetailsActivity(RunningState.MergedItem mi) {
    if (mOwner != null) {
      // start new fragment to display extended information
      Bundle args = new Bundle();
      if (mi.mProcess != null) {
        args.putInt(RunningServiceDetails.KEY_UID, mi.mProcess.mUid);
        args.putString(RunningServiceDetails.KEY_PROCESS, mi.mProcess.mProcessName);
      }
      args.putInt(RunningServiceDetails.KEY_USER_ID, mi.mUserId);
      args.putBoolean(RunningServiceDetails.KEY_BACKGROUND, mAdapter.mShowBackground);

      PreferenceActivity pa = (PreferenceActivity) mOwner.getActivity();
      pa.startPreferencePanel(
          RunningServiceDetails.class.getName(),
          args,
          R.string.runningservicedetails_settings_title,
          null,
          null,
          0);
    }
  }