0
android.app.ProgressDialog
처리시 android.os.AsyncTask
접근 방식에 익숙하지 않습니다. android.database.Cursor
을 통해 특정 쿼리를 처리하고 필요한 엔티티로 변환하는 문제가 있습니다.Android ProgressDialog 쿼리 처리
이 템플릿을 따르고 있지만 항상 android.view.WindowManager$BadTokenException
을 반환합니다.
List<Entity> loadData() throws Exception {
AsyncTask<Cursor, Void, List<Entity>> process = new AsyncTask<Cursor, Void, List<Entity>>() {
ProgressDialog dialog;
protected void onPreExecute() {
dialog = ProgressDialog.show(getApplicationContext(), "Please wait...", "Loading data...");
}
protected void onPostExcecute() {
dialog.dismiss();
}
@Override
protected List<Entity> doInBackground(Cursor... params) {
List<Entity> entities = new ArrayList<Entity>();
// process of convertion of data from android.database.Cursor to <pacakge>.Entity
return entities;
}
}.execute(/* the query : android.database.Cursor */)
return process.get();
}
내가 누락 된 것이 있습니까? Activity
에서 별도의 클래스에서 실행되는
dialog = ProgressDialog.show(Your_Current_Activity.this,
"Please wait...",
"Loading data...");
AsyncTask
경우 다음 현재 활동을 통과해야합니다
ProgressDialog가 나타나지 않거나 프로세스가 끝날 때 나타나지 않습니다. –
@ Dr.Java : doInBackground 실행이 완료되지 않을 때까지 UI를 고정시키는 AsyncTask의 get 메소드를 사용 중이므로 오류가 아닙니다. –
어떻게 해결할 수 있을지에 대한 제안이 있으십니까? –