Frage

Can someone tell me what wrong with my code ? I want to call the ProgressDialog during loading the subject details.

Here is part of the whole code.

public class ScheduleFragment extends Fragment {
/*    others activity    */

public ProgressDialog pDialog;

// Loading subject in Background Thread
    new LoadAllSubject(getActivity()).execute();


class LoadAllSubject extends AsyncTask<String, String, String> {


    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        pDialog = ProgressDialog.show(ScheduleFragment.this, "Progress", "Loading subjects. Please wait...");
        pDialog.setIndeterminate(false);
        pDialog.setCancelable(false);
    }
 }
War es hilfreich?

Lösung

You need to call your background thread inside "onCreateView"

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top