Java Code Examples for androidx.preference.Preference#getExtras()

The following examples show how to use androidx.preference.Preference#getExtras() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SettingsActivity.java    From Infinity-For-Reddit with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference pref) {
    // Instantiate the new Fragment
    final Bundle args = pref.getExtras();
    final Fragment fragment = getSupportFragmentManager().getFragmentFactory().instantiate(
            getClassLoader(),
            pref.getFragment());
    fragment.setArguments(args);
    fragment.setTargetFragment(caller, 0);

    getSupportFragmentManager().beginTransaction()
            .replace(R.id.frame_layout_settings_activity, fragment)
            .addToBackStack(null)
            .commit();
    setTitle(pref.getTitle());
    return true;
}
 
Example 2
Source File: SettingsActivity.java    From intra42 with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference pref) {
    // Instantiate the new Fragment
    final Bundle args = pref.getExtras();
    final Fragment fragment = getSupportFragmentManager().getFragmentFactory().instantiate(
            getClassLoader(),
            pref.getFragment());
    fragment.setArguments(args);
    fragment.setTargetFragment(caller, 0);
    // Replace the existing Fragment with the new Fragment
    getSupportFragmentManager().beginTransaction()
            .replace(R.id.settings, fragment)
            .addToBackStack(null)
            .commit();
    setTitle(pref.getTitle());
    return true;
}
 
Example 3
Source File: PreferencesActivity.java    From TowerCollector with Mozilla Public License 2.0 6 votes vote down vote up
@Override
public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference pref) {
    // instantiate the new Fragment
    final Bundle args = pref.getExtras();
    final Fragment fragment = getSupportFragmentManager().getFragmentFactory().instantiate(
            getClassLoader(),
            pref.getFragment());
    fragment.setArguments(args);
    fragment.setTargetFragment(caller, 0);
    // replace the existing Fragment with the new Fragment
    getSupportFragmentManager().beginTransaction()
            .replace(R.id.preferences_container, fragment)
            .addToBackStack(null)
            .commit();
    setTitle(pref.getTitle());
    return true;
}
 
Example 4
Source File: SettingsActivity.java    From Android-Developer-Fundamentals-Version-2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference pref) {
    // Instantiate the new Fragment
    final Bundle args = pref.getExtras();
    final Fragment fragment = getSupportFragmentManager().getFragmentFactory().instantiate(getClassLoader(), pref.getFragment());
    fragment.setArguments(args);
    fragment.setTargetFragment(caller, 0);
    // Replace the existing Fragment with the new Fragment
    getSupportFragmentManager().beginTransaction()
            .replace(R.id.settings, fragment)
            .addToBackStack(null)
            .commit();
    setTitle(pref.getTitle());
    return true;
}
 
Example 5
Source File: SettingsActivity.java    From Android-Developer-Fundamentals-Version-2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference pref) {
    // Instantiate the new Fragment
    final Bundle args = pref.getExtras();
    final Fragment fragment = getSupportFragmentManager().getFragmentFactory().instantiate(getClassLoader(), pref.getFragment());
    fragment.setArguments(args);
    fragment.setTargetFragment(caller, 0);
    // Replace the existing Fragment with the new Fragment
    getSupportFragmentManager().beginTransaction()
            .replace(R.id.settings, fragment)
            .addToBackStack(null)
            .commit();
    setTitle(pref.getTitle());
    return true;
}