Mam problem z przerwaniem pobierania w AsyncTask:
DownloadZip DlZipTask = new DownloadZip();
w doInBackground (całość http://pastebin.com/phGSqgY7 ):
while ((count = input.read(data)) != -1){
if(isCancelled())
break;
total += count;
publishProgress(""+(int)((total*100)/lenghtOfFile));
output.write(data, 0, count);
}
przerywać chcę z paska powiadomień:
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.getFlags();
intent.putExtra("EXIT", true);
PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), downloadinprogress, intent, 0);
mBuilder.addAction(R.drawable.btn_disimss, getResources().getString(R.string.notif_cancel), contentIntent);
i w końcu:
if (getIntent().getBooleanExtra("EXIT", false)) {
NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(downloadinprogress);
DlZipTask.cancel(true);
}
Klikam Anuluj w belce i belka się zwija, ale dalej pojawia się czarne tło na cały ekran tak z 10 sekund i aplikacja nie odpowiada czy chcesz zamknąć..