java - Android: How to get an intent from a PendingIntent -


i have problem in program. have created pendingintent , have broadcast through alarmmanager. want extras intent passed pendingintent when open program 2nd time. please me this. here code:

protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(com.example.silentmodeapp.r.layout.fajar);     tpstarttime = (timepicker) findviewbyid(com.example.silentmodeapp.r.id.tpstarttime);     tpendtime = (timepicker) findviewbyid(com.example.silentmodeapp.r.id.tpendtime);     setprayertime = (button) findviewbyid(com.example.silentmodeapp.r.id.btsettime);     cancelprayertime = (button) findviewbyid(com.example.silentmodeapp.r.id.btcanceltime);     rbcheck=(radiobutton) findviewbyid(com.example.silentmodeapp.r.id.rbcheck);  //here want intent use info in it.///////////////////////////////////////////////      if((pendingintent.getbroadcast(this, 0, intent, pendingintent.flag_no_create) != null)){         pendingintent startintent=(pendingintent.getbroadcast(this, 0, intent, pendingintent.flag_no_create));         rbcheck.setchecked(true);     }else {         rbcheck.setchecked(false);     } }  @override public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.     getmenuinflater().inflate(             com.example.silentmodeapp.r.menu.activity_main, menu);     return true; }  public void setprayertime(view v) {     try {          calendar calendar = calendar.getinstance();         calendar calendar2 = calendar.getinstance();          // set time ending , starting time.         calendar.set(calendar.hour_of_day, tpstarttime.getcurrenthour());         calendar.set(calendar.minute, tpstarttime.getcurrentminute() - 1);         calendar2.set(calendar.hour_of_day, tpendtime.getcurrenthour());         calendar2.set(calendar.minute, tpendtime.getcurrentminute() - 1);          intent.setclass(this, setsilentservice.class);         intent.putextra("start", "silent mode started!");         intent2.setclass(this, removesilentservice.class);         intent2.putextra("ended", "silent mode removed!");          mp = mediaplayer.create(fajar.this,                 com.example.silentmodeapp.r.raw.set_time);         mp.start();         pendingintent = pendingintent.getservice(this, 0, intent,                 pendingintent.flag_update_current);         pendingintent2 = pendingintent.getservice(this, 1, intent2,                 pendingintent.flag_update_current);          alarmmanager1 = (alarmmanager) getsystemservice(context.alarm_service);         alarmmanager1.set(alarmmanager.rtc_wakeup,                 calendar.gettimeinmillis(), pendingintent);         alarmmanager1.set(alarmmanager.rtc_wakeup,                 calendar2.gettimeinmillis(), pendingintent2);          toast.maketext(                 this,                 "time set " + tpstarttime.getcurrenthour() + ":"                         + tpstarttime.getcurrentminute() + " "                         + tpendtime.getcurrenthour() + ":"                         + tpendtime.getcurrentminute(), toast.length_short)                 .show();         rbcheck.setchecked(true);          // startservice(intent2);     } catch (exception e) {         toast.maketext(this, e.tostring(), toast.length_short).show();      }  } 


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -