my edittext uses getextra previous page , page im handling editing when process nothing because of edittext causing read android.support.v7.widget.appcompatedittext
not string in edittext. please me guys. thanks. :)
acceptcars.java
public class acceptcars implements serializable { @serializedname("acceptedid") public int acceptedid; @serializedname("acceptdate") public string acceptdate; @serializedname("accepttime") public string accepttime; @serializedname("acceptmodel") public string acceptmodel; @serializedname("accepttype") public string accepttype; @serializedname("acceptimage") public string acceptimage; @serializedname("acceptfueltype") public string acceptfueltype; @serializedname("acceptplatenumber") public string acceptplatenumber; @serializedname("acceptcarowner") public string acceptcarowner; @serializedname("acceptreslocation") public string acceptreslocation; @serializedname("acceptcapacity") public string acceptcapacity; @serializedname("renter") public string renters; @serializedname("acceptprice") public string acceptprice; @serializedname("acceptdestination") public string acceptdestination; }
acceptedactivity.java (1stclass)
public class acceptedactivity extends appcompatactivity { textview tvresid, tvcarmodel, tvcartype, tvcapacity, tvfueltype, tvplatenumber, tvresdate, tvrestime,tvreslocation,tvposter,tvrenter, tvdestination, tvprice; imageview ivimage; private static button btncancel; private static button btnresched; private arraylist<acceptcars> carlist; private fundapter<acceptcars> adapter; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_accepted); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); onbuttonclick(); getsupportactionbar().setdisplayhomeasupenabled(true); final acceptcars cars = (acceptcars) getintent().getserializableextra("cars"); imageloader.getinstance().init(uilconfig.config(acceptedactivity.this)); tvcarmodel = (textview)findviewbyid(r.id.tvcarmodel); tvcartype = (textview)findviewbyid(r.id.tvcartype); tvcapacity = (textview)findviewbyid(r.id.tvcapacity); tvfueltype = (textview)findviewbyid(r.id.tvfueltype); tvposter = (textview)findviewbyid(r.id.tvposter); tvplatenumber = (textview)findviewbyid(r.id.tvplatenumber); tvresdate = (textview) findviewbyid(r.id.tvresdate); tvrestime = (textview) findviewbyid(r.id.tvrestime); tvreslocation = (textview) findviewbyid(r.id.tvreslocation); tvprice = (textview) findviewbyid(r.id.tvprice); tvdestination = (textview) findviewbyid(r.id.tvdestination); tvrenter = (textview) findviewbyid(r.id.tvrenter); tvresid = (textview) findviewbyid(r.id.tvresid); ivimage = (imageview)findviewbyid(r.id.ivimg); if (cars != null) { tvresid.settext(""+ cars.acceptedid); tvcarmodel.settext(cars.acceptmodel); tvcartype.settext(cars.accepttype); tvcapacity.settext(cars.acceptcapacity); tvfueltype.settext(cars.acceptfueltype); tvplatenumber.settext(cars.acceptplatenumber); tvresdate.settext(cars.acceptdate); tvrestime.settext(cars.accepttime); tvreslocation.settext(cars.acceptreslocation); tvposter.settext(cars.acceptcarowner); tvrenter.settext(cars.renters); tvdestination.settext(cars.acceptdestination); tvprice.settext(cars.acceptprice); imageloader.getinstance().displayimage(cars.acceptimage, ivimage); } } public void onbuttonclick(){ btncancel = (button) findviewbyid(r.id.btncancel); btncancel.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { alertdialog.builder a_cancel = new alertdialog.builder(acceptedactivity.this); a_cancel.setmessage("are sure want cancel rent?") .setcancelable(false) .setpositivebutton("yes", new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { hashmap postdata = new hashmap(); postdata.put("acceptedid",""+tvresid.gettext().tostring()); postresponseasynctask taskpost = new postresponseasynctask(acceptedactivity.this, postdata, new asyncresponse() { @override public void processfinish(string s) { if (s.contains("success")){ toast.maketext(acceptedactivity.this, "rent cancelled", toast.length_short).show(); intent in = new intent(acceptedactivity.this,rentertabs.class); startactivity(in); finish(); }else{ toast.maketext(acceptedactivity.this, "error", toast.length_short).show(); } } }); taskpost.execute("http://carkila.esy.es/cancellation.php"); } }) .setnegativebutton("no", new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { dialog.cancel(); } }); alertdialog alert = a_cancel.create(); alert.settitle("cancel"); alert.show(); } }); btnresched = (button) findviewbyid(r.id.resched); btnresched.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { alertdialog.builder a_resched = new alertdialog.builder(acceptedactivity.this); a_resched.setmessage("are sure want reschedule rent?") .setcancelable(false) .setpositivebutton("yes", new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { final acceptcars cars = (acceptcars) getintent().getserializableextra("cars"); intent in2 = new intent (acceptedactivity.this,reschedclick.class); in2.putextra("e1",cars.acceptmodel); in2.putextra("e2",cars.accepttype); in2.putextra("e3",cars.acceptcapacity); in2.putextra("e4",cars.acceptplatenumber); in2.putextra("e5",cars.acceptdate); in2.putextra("e6",cars.accepttime); in2.putextra("e7",cars.acceptreslocation); in2.putextra("e8",cars.acceptcarowner); in2.putextra("e9",cars.renters); in2.putextra("e10",cars.acceptdestination); in2.putextra("e11",cars.acceptprice); in2.putextra("e12",cars.acceptedid); startactivity(in2); } }) .setnegativebutton("no", new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { dialog.cancel(); } }); alertdialog alert1 = a_resched.create(); alert1.settitle("reschedule"); alert1.show(); } }); }
reschedclick.java (2ndclass)
public class reschedclick extends appcompatactivity implements view.onclicklistener { textview tvcarmodel, tvcartype, tvcapacity, tvfueltype, tvplatenumber, tvposter, tvprice, tvacceptedid; edittext etresdate, etrestime, etreturndate, etreturntime, etreslocation, etdestination; imageview ivimage; int year_x,month_x,day_x; final string tag = this.getclass().getname(); int hour_x,minute_x; galleryphoto galleryphoto; button btnresched; string e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11, e12; static final int dialog_id = 0; static final int dialog_id2 =2; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_re_sched_click); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); getsupportactionbar().setdisplayhomeasupenabled(true); showdialogonbuttonclick(); galleryphoto = new galleryphoto(getapplicationcontext()); imageloader.getinstance().init(uilconfig.config(reschedclick.this)); final calendar cal = calendar.getinstance(); year_x = cal.get(calendar.year); month_x = cal.get(calendar.month); day_x = cal.get(calendar.day_of_month); etreslocation = (edittext) findviewbyid(r.id.etpickup); etdestination= (edittext) findviewbyid(r.id.etdestination); tvcarmodel = (textview)findviewbyid(r.id.tvcarmodel); tvcartype = (textview)findviewbyid(r.id.tvcartype); tvcapacity = (textview)findviewbyid(r.id.tvcapacity); tvfueltype = (textview)findviewbyid(r.id.tvfueltype); tvposter = (textview)findviewbyid(r.id.tvposter); tvplatenumber = (textview)findviewbyid(r.id.tvplatenumber); ivimage = (imageview)findviewbyid(r.id.ivimage); tvprice = (textview) findviewbyid(r.id.tvprice); tvacceptedid= (textview) findviewbyid(r.id.tvacceptedid); btnresched = (button) findviewbyid(r.id.btnresched); btnresched.setonclicklistener(this); intent in2 = getintent(); e1 = in2.getstringextra("e1"); e2 = in2.getstringextra("e2"); e3 = in2.getstringextra("e3"); e4 = in2.getstringextra("e4"); e5 = in2.getstringextra("e5"); e6 = in2.getstringextra("e6"); e7 = in2.getstringextra("e7"); e8 = in2.getstringextra("e8"); e9 = in2.getstringextra("e9"); e10 = in2.getstringextra("e10"); e11 = in2.getstringextra("e11"); e12 = in2.getstringextra("e12"); tvcarmodel.settext(e1); tvcartype.settext(e2); tvcapacity.settext(e3); tvplatenumber.settext(e4); etresdate.settext(e5); etrestime.settext(e6); etreslocation.settext(e7); tvposter.settext(e8); etdestination.settext(e10); tvprice.settext(e11); tvacceptedid.settext(e12); } public void showdialogonbuttonclick(){ etresdate = (edittext) findviewbyid(r.id.etresdate); etrestime = (edittext) findviewbyid(r.id.etrestime); etresdate.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { showdialog(dialog_id); } }); etrestime.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { showdialog(dialog_id2); } }); } @override protected dialog oncreatedialog(int id) { if(id == dialog_id){ return new datepickerdialog(this, dplistener, year_x,month_x,day_x); } else if (id == dialog_id2){ return new timepickerdialog(this, tplistener, hour_x, minute_x,false); } return null; } private datepickerdialog.ondatesetlistener dplistener = new datepickerdialog.ondatesetlistener() { @override public void ondateset(datepicker view, int year, int monthofyear, int dayofmonth) { year_x = year; month_x = monthofyear + 1; day_x = dayofmonth; etresdate.settext(month_x + "/" + day_x + "/" + year_x); } }; protected timepickerdialog.ontimesetlistener tplistener = new timepickerdialog.ontimesetlistener() { @override public void ontimeset(timepicker view, int hourofday, int minute) { hour_x = hourofday; minute_x = minute; etrestime.settext(hour_x +" : " + minute_x ); } }; @override public void onclick(view v) { hashmap postdata = new hashmap(); postdata.put("acceptedid",tvacceptedid.gettext().tostring()); postdata.put("etresdate",etresdate.gettext().tostring()); postdata.put("etrestime",etrestime.gettext().tostring()); postdata.put("etreslocation",etreslocation.gettext().tostring()); postdata.put("etresdestination",etdestination.gettext().tostring()); postresponseasynctask taskpost = new postresponseasynctask(reschedclick.this, postdata, new asyncresponse() { @override public void processfinish(string s) { if(s.contains("success")){ toast.maketext(reschedclick.this, "rental rescheduled!", toast.length_short).show(); intent in3 = new intent(reschedclick.this, rentertabs.class); startactivity(in3); finish(); }else{ toast.maketext(reschedclick.this, "error", toast.length_short).show(); } } }); taskpost.execute("http://carkila.esy.es/reschedule.php"); }
Comments
Post a Comment