문제

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);
    }
 }
도움이 되었습니까?

해결책

You need to call your background thread inside "onCreateView"

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top