json - Multiple textviews displaying Volley response getting blank: Android -
i having app shows list of several companies branches. using volley fetch , display business hours of each of company. business hours shown alright when there single branch in case of companies multiple branches, business hours blank except last one. getting details correct on logging not in layout.
below code volley request,
public void getdata(final relativelayout timelayoutcollapse, final relativelayout timelayout, final int) { //url fetching branch time server. string url = context.getstring(site_url) + "branch_time.cfc?method=branchtime&branchid=" + dbranchid; log.d(url, "this urlllll"); stringrequest stringrequest = new stringrequest(url, new response.listener<string>() { @override public void onresponse(string response) { // log.d(string.valueof(response), "reqqqqqqqqq"); showjson(response, timelayoutcollapse, timelayout); } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { timelayout.setvisibility(view.gone); } }); requestqueue requestqueue = volley.newrequestqueue(context); requestqueue.add(stringrequest); }
i calling getdata() method from,
final int size = brancheslist.size(); if (size >= 2) { companyname.settext(brancheslist.get(i).getbranchname()); businesshours.settext(brancheslist.get(i).getbranchname() + " business hours:"); log.d(string.valueof(bid), "barchidddd"); log.d(brancheslist.get(i).getbranchname(), "list branch newwwwwww"); timelayoutcollapse.setvisibility(view.gone); getdata(timelayoutcollapse, timelayout); }
the json parsing , displaying done in,
public void showjson(final string response, relativelayout timelayoutcollapse, relativelayout timelayout) { jsonobject jsonobject = new jsonobject(response); jsonarray result = jsonobject.getjsonarray("data"); final int numberofitemsinbranch = result.length(); log.d(string.valueof(result),"checcccckkkkkk"); timestatus.settext("business hours "); currentstatus.settext("unknown");
the data in logs such as,
d/0: lopppppppppp d/aaa branch: list branch nameeeeeee d/bbb: locaaattiiooon d/0: url branchh d/http://the url/folder/branch_time.cfc?method=branchtime&branchid=0: urlllll d/1758: barchidddd d/cccccc: list branch newwwwwww d/1758: url branchh d/http://the url/folder/branch_time.cfc?method=branchtime&branchid=1758: url
the log data server response,
[d/[[670,1758,1671,"08:00","08:00","08:00","08:00","08:00","09:00","closed","17:00","17:00","17checcccckkkkkk
displaying data in text view as
companytime1.settext(sun_o + '-' + sun_c); companytime2.settext(mon_o + '-' + mon_c);
where,
mon_o = companydata.getstring(3); mon_c = companydata.getstring(10); sun_o = companydata.getstring(9); sun_c = companydata.getstring(16);
i getting required data in logs while displaying them textview texts getting blank. quite new android , cannot figure way out of this. please, can help?
@deepak updating same views different data , last data jsonarray
gets show up. need display in listview or recyclerview
.
Comments
Post a Comment