제발 살려주세요.

 

AsyncTask와 메인액티비티를 완전히 분리하였는데

 

계속 런타임 오류가 발생합니다.

 

Dialog때문인거 같은데 왜 그런지 원인과 대처법을 알 수 있을까요?

 

public class AsyncTaskDownload extends AsyncTask<Integer, Integer, Integer> {
 ProgressDialog mProgress;
 Context context;
 String sdFileName;
 int totalDownloadSize = 0;
 public AsyncTaskDownload(Context context, String sdFileName) {
  // TODO Auto-generated constructor stub
  this.context = context;
  this.sdFileName = sdFileName;
 }

 @Override
 protected void onPreExecute() {
  // TODO Auto-generated method stub
  totalDownloadSize = 0;
  mProgress = new ProgressDialog(context);
  mProgress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
  mProgress.setTitle("다운로드 진행중...");
  mProgress.setMessage("잠시만 기다려주세요.");
  mProgress.setCancelable(false);
  mProgress.setProgress(0);
  mProgress.setButton("취소", new DialogInterface.OnClickListener() {
   
   @Override
   public void onClick(DialogInterface arg0, int arg1) {
    // TODO Auto-generated method stub
    cancel(true);
   }
  });
  mProgress.show();
 }
 
 @Override
 protected Integer doInBackground(Integer... fileFullSizeValue) {
  // TODO Auto-generated method stub
 MemoryUtil.setMissZineDir(MemoryUtil.EXTERNAL_MISSZINE_IMAGE_PATH, false); //폴더 유무 체크 후 생성
 //mProgress.setMax(NetworkUtils.getDownloadFileFullSize("http://xxxx.cafe24.com/test/a1.zip")); // 다운받을 파일의 최대 사이즈
 try {
 URL url = new URL("http://xxxx.cafe24.com/test/a1.zip");
 InputStream is = url.openStream();
 
 File outputFile = new File(MemoryUtil.EXTERNAL_MISSZINE_IMAGE_PATH + "/" + sdFileName);
 FileOutputStream fos = new FileOutputStream(outputFile);
 
 int data = 0;
 byte[] buf = new byte[1024];
 
 while(isCancelled() == false)
 {
  while((data = is.read(buf))!= -1)
  {
   fos.write(buf, 0, data);
   totalDownloadSize+=data;
   publishProgress(totalDownloadSize);
  }
  is.close();
  fos.close();
 }
 
 }catch(Exception e) {e.toString();}
 return totalDownloadSize;
 }
 
 @Override
 protected void onProgressUpdate(Integer... values) {
  // TODO Auto-generated method stub
  mProgress.setProgress(values[0]);
 }
 
 @Override
 protected void onPostExecute(Integer result) {
  // TODO Auto-generated method stub
  mProgress.dismiss();
  Toast.makeText(context, "다운로드가 완료되었습니다.", 1000).show();
 }
 
 @Override
 protected void onCancelled() {
  // TODO Auto-generated method stub
  mProgress.dismiss();
 };