android - How do i implement an endless scroll to onResume()? -
how implement endless scroll onresume(), oncreateview, implement endless scroll , works fine when comes onresume(), doesn't work in shows blank data.
here's code oncreate
public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { onrestoreinstancestate(savedinstancestate); view rootview = inflater.inflate(com.barakah.camel.r.layout.browse_fragment_layout, container, false); setupfloatingactionmenu(getactivity()); recyclerview = (recyclerview) rootview .findviewbyid(com.barakah.camel.r.id.my_recycler_view); layoutmanager = new linearlayoutmanager(getactivity()); recyclerview.setlayoutmanager(layoutmanager); recyclerview.setonscrolllistener(new endlessrecycleronscrolllistener( layoutmanager) { @override public void onloadmore(int current_page) { int limit = current_page * 5; loadmoreitems(limit); } }); return rootview; }
here's code onresume()
public view onresume(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { onrestoreinstancestate(savedinstancestate); super.onresume(); view rootview = inflater.inflate(com.barakah.camel.r.layout.browse_fragment_layout, container, false); setupfloatingactionmenu(getactivity()); recyclerview = (recyclerview) rootview .findviewbyid(com.barakah.camel.r.id.my_recycler_view); layoutmanager = new linearlayoutmanager(getactivity()); recyclerview.setlayoutmanager(layoutmanager); recyclerview.setonscrolllistener(new endlessrecycleronscrolllistener( layoutmanager) { @override public void onloadmore(int current_page) { int limit = current_page * 5; loadmoreitems(limit); } }); return rootview; }
any appreaciated
your onresume()
method not correctly override method of same name found in activity
or fragment
.
the method shouldn't return view
void
method. like may after:
i.e.:
@override public void onresume() { super.onresume(); recyclerview.setonscrolllistener(new endlessrecycleronscrolllistener(layoutmanager) { @override public void onloadmore(int current_page) { int limit = current_page * 5; loadmoreitems(limit); } }); }
Comments
Post a Comment