ruslanys ruslanys - 27 days ago 13
Android Question

Cannot click on item of ListView after scrolling

I have a ListView where every row updating on real time. While file downloading in the ListView you can see the progress of downloading of every file (several files, that's why ListView). And you can click on the item of ListView, and doing something with progress of downloading.

I used method

.notifyDataSetChanged();
of Adapter to set dynamic data. And everything is good, but after scrolling the ListView I cannot click on any item. If I don't scroll, I can click on items that I see without scrolling. How can I fix this?

Answer

Try this - probably your list item clicks are being intercepted (assuming onitemclick listener)

listView.setOnScrollListener(new OnScrollListener() {
        public void onScrollStateChanged(AbsListView view, int scrollState) {
            if ( scrollState == OnScrollListener.SCROLL_STATE_IDLE )
            {
              listView.invalidateViews();
            }

        }

        @Override
        public void onScroll(AbsListView arg0, int arg1, int arg2, int arg3) {}
    });

If this doesnt work post more code so we can understand what you are asking