여기에 문제가 있습니다. onPostExecute() 메서드는 모든 작업을 수행하지 않습니다.AsyncTask onPostExecute가 필요한 모든 작업을 수행하지 않습니다.
내 onPostExecute에서 볼 수 있듯이 부울 값은 어떤 일이 발생하는지 결정합니다. 하지만 로그를 통해 b를 얻는다면 아무 것도 볼 수 없으며 실행되는 코드는 b = true의 코드입니다.
대화 상자에 성공적이라고 표시되지만 환경 설정이 표시되지 않습니다. 업데이트, 여기서 내가 뭘 잘못하고 있니? 좋아
@Override
protected void onPostExecute(Boolean b) {
publishProgress(100);
dialog.dismiss();
if (b) {
e.putInt(Constants.pref_updateweek, cal.get(Calendar.WEEK_OF_YEAR));
e.commit();
AlertDialog.Builder alert = new AlertDialog.Builder(mContext);
alert.setTitle("Succes");
alert.setMessage("Alles is bijgewerkt");
alert.setPositiveButton("Ok", null);
alert.show();
act.commUI();
} else {
AlertDialog.Builder alert = new AlertDialog.Builder(mContext);
alert.setTitle("Error");
alert.setMessage("Er is een fout opgetreden.");
alert.setPositiveButton("Ok", null);
alert.show();
}
}
publishProgress (100); doInBackground()에 있어야합니다. AlertDialog.Builder alert = 새로운 AlertDialog.Builder (mContext); 전에 이것을 옮길 수 있습니까? – Raghunandan
전체 AsynTask의 코드를 넣을 수 있습니까? e.commit()이 반환하는 부울을 살펴보십시오 (새 값이 영구 저장소에 성공적으로 기록 된 경우 true를 반환합니다). sharedpreferences 초기화 문제 일 수 있습니다 <-> – AlexBcn
소스가이 [pastebin] (http://pastebin.com/pkdrRGFV)에서 19:17까지 사용 가능합니다 – WHDeveloper