SuperListview icon indicating copy to clipboard operation
SuperListview copied to clipboard

endless `onMoreAsked` callback?

Open 01joy opened this issue 10 years ago • 4 comments

Your sample app is pretty good except that no onMoreAsked called. So I import your lib in my project and create a fragment like this, but when I scroll down to the bottom, endless "More asked, more served" were created! What' more, I rebuilt your sample project, I got the same result. Why it calls endless onMoreAsked method? Is it a bug? how do i do?

01joy avatar Sep 25 '14 07:09 01joy

I am facing similar problem when I am using this with GridView, with listview is working, its strange!!!

oneenam avatar Sep 30 '14 14:09 oneenam

@oneenam Hi, I solved my problem by using android-pull-to-refresh instead. You can try it.

01joy avatar Sep 30 '14 15:09 01joy

en, In the newest android 5 sdk version 21, it will load more for ever, so there are something is wrong. I think when add some data, we should set isLoadingMore = false; like sample code bellow, so the library design scheme should be changed.

        public void onLoadMore() {
            new AsyncTask<Void, Void, Void>() {

        @Override
        protected Void doInBackground(Void... params) {
            try {
                Thread.sleep(1000); //sleep 1 seconds
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            if (adapter.count <45) {
                adapter.count += 15;
                adapter.notifyDataSetChanged();
                swipeLayout.setRefreshing(false);
                listView.setCanLoadMore(adapter.count < 45);
                listView.onLoadMoreComplete();
                super.onPostExecute(result);
            }
            else
                swipeLayout.setRefreshing(false);
        }

    }.execute();
}

johnvuong20000 avatar Oct 23 '14 18:10 johnvuong20000

In my case, works for the first time I reach the Listview bottom, but not anymore and I don't understand why...

nelo686 avatar Nov 02 '14 01:11 nelo686