Code example for ListFragment

Methods: setArguments

0
 
    public static PreferenceCompatFragment newInstance(int preferences) {
        PreferenceCompatFragment prefFragment = new PreferenceCompatFragment();
        Bundle args = new Bundle();
        args.putInt("xml", preferences);
        prefFragment.setArguments(args);
        return prefFragment;
    } 
 
    @Override 
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        xmlId = getArguments().getInt("xml");
        this.mPreferenceManager = createPreferenceManager();
        this.mListView = (ListView) LayoutInflater.from(getActivity()).inflate(R.layout.preference_list_content, null);
        this.mListView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
        addPreferencesFromResource(this.xmlId);
        postBindPreferences(); 
        //((OnPreferenceAttachedListener) getActivity()).onPreferenceAttached(getPreferenceScreen(), xmlId); 
    }