java - Load More Button Android with Limit and Offset -
i have implemented custom scroll view (not list view). using intent service hit server offset , limit , display result. instance. set offset = 0 , limit = first_batch (int first_batch = 15) first call. returning 15 names , details. , next intent service call. using offset = first_batch , limit = first_batch. retuning next 15 names, 15 30. , displaying load more button @ end of 30 names. here problem. once hit load more button, want display next 15 names, offset = first_batch + first_batch , limit = first_batch. , growing more ..... here implementation ....
private void startname(){ intent getnamesearch = new intent(getsherlockactivity(), intentservice.class); getnamesearch.putextra("search_offset", 0); getnamesearch.putextra("search_limit", first_batch); getnamesearch.setaction(intentservice.action_get_namesearch); getsherlockactivity().startservice(getnamesearch); mcallback.oncreateprogressdialog(); getnamesearch = new intent(getsherlockactivity(), intentservice.class); getnamesearch.putextra("search_offset", first_batch); getnamesearch.putextra("search_limit", first_batch); getnamesearch.setaction(intentservice.action_get_namesearch); getsherlockactivity().startservice(getnamesearch); mcallback.oncreateprogressdialog(); }
once view displayed. loading loadmore button. , once click loadmore button calling intent service again. know wrong. offset 30 everytime. name displayed 30 45 time. want grow. say, after click loadmore button. want 30 45 , again hit load more button, should 45 60 , goes on ...
final button btnaddmore = (button) mynamesearch.findviewbyid(r.id.loadmore); btnaddmore.setvisibility(view.visible); loadmorebutton = false; btnaddmore.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { loadmorebutton(); } });
and here loadmorespinner method
private void loadmorebutton(){ intent getnamesearch = new intent(getsherlockactivity(), intentservice.class); int finaloffset = first_batch * 2; getnamesearch.putextra("search_offset", finaloffset); getnamesearch.putextra("search_limit", first_batch); getnamesearch.setaction(intentservice.action_get_namesearch); getsherlockactivity().startservice(getnamesearch); mcallback.oncreateprogressdialog(); }
Comments
Post a Comment