java - Null values in service class android -


i getting null values in service class :-

if (intent != null && intent.getaction() != null) {         matchname = intent.getstringextra("match");         matchdate = intent.getstringextra("time");          log.d(" service match ", intent.getextras().tostring());     } 

//oncreate code

@override protected void oncreate(bundle savedinstancestate) {

button match1 = (button) findviewbyid(r.id.match1);  match1.setonclicklistener(this); }   @override public void onclick(view v) {  calendar endtime = calendar.getinstance();      simpledateformat inputformat = new simpledateformat(             "yyyy-mm-dd hh:mm:ss a");     inputformat.settimezone(timezone.gettimezone("gmt"));      simpledateformat nativeformat = new simpledateformat(             "yyyy-mm-dd hh:mm:ss a");     nativeformat.settimezone(timezone.getdefault());      simpledateformat nativeformat1 = new simpledateformat(             "yyyy-mm-dd hh:mm a");      string inpt = matchtimeingmt(v); // "2014-03-22 8:45:00 pm";     button matchbutton = (button) v;     string matchname = "abc vs def";       try {         inptdate = inputformat.parse(inpt);         date2 = nativeformat.format(inptdate);         endtime.settime(nativeformat.parse(date2));         // endtime.add(calendar.hour_of_day, 3);          intent intent = new intent(intent.action_edit);         intent.settype("vnd.android.cursor.item/event");         intent.putextra("begintime", endtime.gettimeinmillis());         intent.putextra("allday", false);         intent.putextra("rrule", "freq=yearly;count=1");         intent.putextra("endtime", endtime.gettimeinmillis());         intent.putextra("title", matchname);          startactivity(intent);          calendar cal = calendar.getinstance();         cal.settime(endtime.gettime());          intent svc = new intent(this,myalarmservice.class);         svc.setaction("matchtime");         svc.putextra("match", matchname.tostring());         svc.putextra("time", nativeformat1.format(cal.gettime()).tostring());         startservice(svc);           pendingintent alarmintent;         intent myintent1 = new intent(fixture.this, myreceiver.class);         alarmintent = pendingintent.getbroadcast(fixture.this, 0,                 myintent1, 0);           alarmmanager alarmmanager = (alarmmanager) getsystemservice(alarm_service);         alarmmanager.set(alarmmanager.rtc, endtime.gettimeinmillis(),                 alarmintent);      } catch (exception e) {         e.printstacktrace();     }      } 

log output -bundle[{time=2014-03-25 12:20 am, match=abc vs def}]

i getting values match , time not getting assigned matchname , matchdate variables. please help.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -