Search in sources :

Example 11 with PreferenceFragment

use of android.support.v4.preference.PreferenceFragment in project android_frameworks_base by crdroidandroid.

the class TunerActivity method onPreferenceStartFragment.

@Override
public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) {
    try {
        Class<?> cls = Class.forName(pref.getFragment());
        Fragment fragment = (Fragment) cls.newInstance();
        FragmentTransaction transaction = getFragmentManager().beginTransaction();
        setTitle(pref.getTitle());
        transaction.replace(R.id.content_frame, fragment);
        transaction.addToBackStack("PreferenceFragment");
        transaction.commit();
        return true;
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
        Log.d("TunerActivity", "Problem launching fragment", e);
        return false;
    }
}
Also used : FragmentTransaction(android.app.FragmentTransaction) Fragment(android.app.Fragment) PreferenceFragment(android.support.v14.preference.PreferenceFragment)

Aggregations

PreferenceFragment (android.support.v14.preference.PreferenceFragment)9 Fragment (android.app.Fragment)7 FragmentTransaction (android.app.FragmentTransaction)6 FragmentManager (android.support.v4.app.FragmentManager)2 PreferenceFragment (android.preference.PreferenceFragment)1 Fragment (android.support.v4.app.Fragment)1 Toolbar (android.support.v7.widget.Toolbar)1 SettingsFragment (com.naman14.timber.fragments.SettingsFragment)1 StyleSelectorFragment (com.naman14.timber.subfragments.StyleSelectorFragment)1 LicensesDialogFragment (de.psdev.licensesdialog.LicensesDialogFragment)1