You need to call your background thread inside "onCreateView"
Failed using ProgressDialog in extends Fragment
-
20-06-2023 - |
Pregunta
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);
}
}
Solución
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow