java - I am not getting updated values for strings, Values are being assigned in onResponce() method of Retrofit? -
//code button sets , gets values of strings declared in class level private string hostapptslots1, hapstrtt1,haptavgt1;
getprofdetails(profname); toast.maketext(fix_appointment.this,gethapstrtt1()+gethostapptslots1()+gethaptavg1(), toast.length_short).show();
//code getprofdetails apiservice.profdetails using thread #main_thread
public void getprofdetails(string pusrname){ apiservice.profdetails(pusrname).enqueue(new callback<jsonarray>() { @override public void onresponse(call<jsonarray> call, response<jsonarray> response) { try { jsonarray jsonarray= new jsonarray(response.body().tostring()); jsonobject jsonobject2 = jsonarray.getjsonobject(0); //getting values jsonarray hostapptstarttime=jsonobject2.getstring("hp_starttime"); hostapptavgtime=jsonobject2.getstring("hp_avgtime"); hostapptslots=jsonobject2.getstring("hp_slots"); //setter method used strings sethostapptslots1( hostapptslots); sethapstrtt1(hostapptstarttime); sethaptavgt1(hostapptavgtime); //values being set correctly have checked } catch (jsonexception e) { e.printstacktrace(); } } @override public void onfailure(call<jsonarray> call, throwable throwable) { } });
Comments
Post a Comment