How can I add a progress bar in a PreferenceFragment? I have some async task running that will display some values in my preference upon completion. So while it is doing the background process, I plan to show only a progress bar in the center. After the task is complete, then I plan to show all my preferences.
Here's what I have so far.
PreferenceFragment
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.pref_account);
    }
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    new AsyncTask<Void,Void,Void>() {
        String firstName, lastName, email;
        @Override
        protected void doInBackground() {
            // Doing something here to fetch values
        }
        @Override
        protected void onPostExecute() {
            findPreference("first_name").setSummary(firstName);
            findPreference("last_name").setSummary(lastName);
            findPreference("email").setSummary(email);
        }
    }
}
pref_account.xml
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
    <Preference android:key="first_name"
        android:title="@string/prompt_first_name"
        android:summary="" />
    <Preference android:key="last_name"
        android:title="@string/prompt_last_name"
        android:summary="" />
    <Preference android:key="email"
        android:title="@string/prompt_email"
        android:summary=""
        android:inputType="textEmailAddress" />
    <Preference android:key="sign_out"
        android:title="@string/action_sign_out" />
</PreferenceScreen>
My question is, since this is a PreferenceFragment and I'm not overriding the method onCreateView, where and how should I add the progress bar?
 
    
 
     
     
    