android - Updating download progress bar into notification area from AsynTask -


i have implemented async task service. here initializing of progress notification, calling onpreexecute.

mprogressnotificationmanager = (notificationmanager)             .getsystemservice(context.notification_service);      charsequence tickertext = "download";      mprogressnotification = new notification(r.drawable.ic_launcher, tickertext, system.currenttimemillis());     context = this.getapplicationcontext();      intent mnotificationintent = new intent(context, activityclass.class);     pendingintent mpendingintent = pendingintent.getactivity(context, 0, mnotificationintent, 0);     //mprogressnotification.flags |= notification.flag_auto_cancel;     mprogressnotification.flags = mprogressnotification.flags | notification.flag_ongoing_event;     charsequence title = "downloading initializing...";     remoteviews contentview = new remoteviews(getpackagename(),             r.layout.noti);     contentview.setimageviewresource(r.id.status_icon,             r.drawable.ic_launcher);     contentview.settextviewtext(r.id.status_text, title);     contentview.setprogressbar(r.id.status_progress, 100, 0, false);     mprogressnotification.contentview = contentview;     mprogressnotification.contentintent = mpendingintent;     mprogressnotificationmanager.notify(status_bar_notification, mprogressnotification); 

after in doinbackground , have implemented download procedure, , after updating download progress,

@override     protected void onprogressupdate(integer... progress) {         super.onprogressupdate(progress);          int mdownloadprogress = progress[0];         // log.d(tag,"asynctask : download in progress");                    charsequence title =  "filename" +":  "  + mdownloadprogress + "%";         mprogressnotification.contentview.settextviewtext(r.id.status_text, title);         mprogressnotification.contentview.setprogressbar(r.id.status_progress, 100,                 mdownloadprogress, false);         mprogressnotificationmanager.notify(status_bar_notification, mprogressnotification);                  } 

it working fine.. updating properly, issue that, notification bar hanged. can not up-down notification bar. want update notification bar downloading application google market (play) .

thanks...

what appears happening replacing notification meaning there new notification show.

what need update notification , not replace it.

have @ :)

http://developer.android.com/guide/topics/ui/notifiers/notifications.html#updating


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -