Android: update specific notification from multiple notifications which have remoteview -


i creating application contain notification have play/pause icon , which. works perfect when there have 1 notification have 1 notification id, change play/pause icon through 1 notificationid, there have issue multiple notification. when there have multiple notification, each notification have play/pause icon. when click play/pause icon 1 of notification, changing top notification icon stack of notification. know problem due notification-id got on click on notification.i want id notification on click of play/pause icon.i have tried changing of pendingintent content , not found yet exact solution.

i want know , is there way notificationid of notification,on click of play/pause icon of that?, can change icon or update notification through notification id.need update notification through there notification id.

i have used remote-view costume layout in notification. code below

notificationcode

    remoteviews mremoteviews1 = null;     pendingintent pendingintent = null;     pendingintent pendingintent1 = null;     pendingintent pendingintent2 = null;     pendingintent pendingintent3 = null;     pendingintent pendingintent4 = null;     pendingintent pendingintent5 = null;      if (mremoteviews1 == null) {         log.d("log", "mremoteviews null");              mremoteviews1 = new remoteviews(getpackagename(),                     r.layout.custom_notification);      } else {         if (mstate == palyer.paused || mstate == palyer.stopped) {              try {                 log.e("log", "state.paused || state.stopped");                 mremoteviews1.setimageviewresource(r.id.playpush,                         r.drawable.playdetailfornoti);  // play icon              } catch (exception e) {}          } else if (mstate == palyer.playing) {             try {                 log.e("log", "state.playing");                 mremoteviews1.setimageviewresource(r.id.playpush,                         r.drawable.pushdetail);   // pushicon              } catch (exception e) {}         } else if (mstate == palyer.retrieving) {             try {                 log.e("log", "else retrieving");                 mremoteviews1.setimageviewresource(r.id.playpush,                         r.drawable.playdetailfornoti); // play icon              } catch (exception e) {}         }         else {             try {                 log.e("log", "else");                 mremoteviews1.setimageviewresource(r.id.playpush,                         r.drawable.pushdetail);   // pushicon              } catch (exception e) {}         }     }      intent intent = new intent(action_toggle_playback);     intent intent1 = new intent(close_push_notification);     intent intent2 = new intent(action_next);     intent intent3 = new intent(action_previous);     intent intent4 = new intent(action_stop);     intent intent5 = new intent(action_play_notification_start);      intent newintent = new intent(this, splace.class);     newintent.putextra("newsid",_id);     newintent.putextra("message",title);     newintent.addflags(intent.flag_activity_new_task |              intent.flag_activity_single_top);     newintent.setaction("actionstring" + system.currenttimemillis());      pendingintent = pendingintent.getservice(getapplicationcontext(),             request_code_stop, intent, pendingintent.flag_update_current);     pendingintent1 = pendingintent.getservice(getapplicationcontext(), 0,             intent1, 0);     pendingintent2 = pendingintent.getservice(getapplicationcontext(),             request_code_stop, intent2, pendingintent.flag_update_current);     pendingintent3 = pendingintent.getservice(getapplicationcontext(),             request_code_stop, intent3, pendingintent.flag_update_current);     pendingintent contentintent = pendingintent.getactivity(this, 0,             newintent, 0);     pendingintent4 = pendingintent.getservice(getapplicationcontext(),             request_code_stop, intent4, pendingintent.flag_update_current);     pendingintent5 = pendingintent.getservice(getapplicationcontext(),             request_code_stop, intent5, pendingintent.flag_update_current);       mremoteviews1.settextviewtext(r.id.playertitle,             musiclist.currentnotificationentity.scrape_title);      mremoteviews1                 .settextviewtext(r.id.playerapaer, base                         .getnewspapername(base.sharedpref.getstring(                                 musiclist.currentnotificationentity.newspaperid,                                 "palpal")));     mremoteviews1.setonclickpendingintent(r.id.forward, pendingintent2);     mremoteviews1.setonclickpendingintent(r.id.backword, pendingintent3);      mremoteviews1.setonclickpendingintent(r.id.playertitle, contentintent);     mremoteviews1.setonclickpendingintent(r.id.playerapaer, contentintent);     mremoteviews1.setonclickpendingintent(r.id.playerimage, contentintent);      mremoteviews1.setonclickpendingintent(r.id.playpush, pendingintent);     mremoteviews1.setonclickpendingintent(r.id.close, pendingintent1);      notification  mnotification1 = new notificationcompat.builder(                 getapplicationcontext())                 .setsmallicon(r.drawable.ic_launcher)                 .setwhen(system.currenttimemillis())                 .setpriority(notification.priority_high)                 .setdeleteintent(pendingintent1)                 .setautocancel(true)                 .setcontent(mremoteviews1).setongoing(false).build();      mnotificationmanager.notify(base.currentnotificationno, mnotification1); 

please me in advance

i add id in intent put pendingintent know notification operating on, this:

intent intent = new intent(action_toggle_playback);

intent.putextra(extra_id, songid);

you can pull out later in code getting called:

string songid = intent.getstringextra(extra_id);


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -