コード例 #1
0
  /**
   * Inflates the given XML resource and adds the preference hierarchy to the current preference
   * hierarchy.
   *
   * @param preferencesResId The XML resource ID to inflate.
   */
  public void addPreferencesFromResource(int preferencesResId) {
    requirePreferenceManager();

    setPreferenceScreen(
        PreferenceManagerCompat.inflateFromResource(
            mPreferenceManager, getActivity(), preferencesResId, getPreferenceScreen()));
  }
コード例 #2
0
  /**
   * Adds preferences from activities that match the given {@link android.content.Intent}.
   *
   * @param intent The {@link android.content.Intent} to query activities.
   */
  public void addPreferencesFromIntent(Intent intent) {
    requirePreferenceManager();

    setPreferenceScreen(
        PreferenceManagerCompat.inflateFromIntent(
            mPreferenceManager, intent, getPreferenceScreen()));
  }