PreferenceFragmentCompat custom layout : <p>I need a custom layout for my PreferenceFragmentCompat. In the docs for <a href="http://developer.android.com/reference/android/support/v7/preference/PreferenceFragmentCompat.html#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)" rel="noreferrer">PreferenceFragmentCompat</a> it seems that you can possibly inflate and return a view in onCreateView().</p>

<p>However a NPE results:-</p>

<pre><code>Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setAdapter(android.support.v7.widget.RecyclerView$Adapter)' on a null object reference
                                                                       at android.support.v7.preference.PreferenceFragmentCompat.bindPreferences(PreferenceFragmentCompat.java:511)
                                                                       at android.support.v7.preference.PreferenceFragmentCompat.onActivityCreated(PreferenceFragmentCompat.java:316)
                                                                       at com.cls.example.MyPrefFrag.onActivityCreated(MyPrefFrag.java:42) 
</code></pre>

<p>After I checked the source of PreferenceFragmentCompat:onCreateView I found the following piece of code :-</p>

<pre><code> RecyclerView listView = this.onCreateRecyclerView(themedInflater, listContainer, savedInstanceState);
 if(listView == null) {
    throw new RuntimeException("Could not create RecyclerView");
 } else {
    this.mList = listView;   //problem
    ...
    return view;
 }
</code></pre>

<p>So if you override onCreateView() and return a custom layout the onCreateRecyclerView() is not called plus the RecyclerView private field mList will not be set. So the NPE on setAdapter() results.</p>

<p>Should I assume that having a custom layout is not feasible for PreferenceFragmentCompat ?</p>
