Listview scrolling up freezing

1.2k Views Asked by At

I have listview with custom cursoradapter. It contains few hundred of items. Scrolling down is smooth and fast but scrolling back - up is freezing all the time. I don't load image or some operation on UI thread. Only get few values from cursor and set it into textviews

private class EpisodesAdapter extends CursorAdapter {
        LayoutInflater inflater;
        public EpisodesAdapter(Context context) {
            super(context, null, false);
            inflater = (LayoutInflater)     context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        }

        @Override
        public View newView(Context context, Cursor cursor, ViewGroup parent) {

            View view = inflater.inflate(R.layout.list_item_episode, parent,  false);

            view.setBackgroundResource(R.drawable.abs__list_selector_holo_light);
            return view;
        }

        @Override
        public void bindView(View view, final Context context, final Cursor cursor) {
            final String title = cursor.getString(EpisodesQuery.EPISODE_TITLE);
            final String episodeId = cursor.getString(EpisodesQuery.EPISODE_ID);
            final String time = cursor.getString(EpisodesQuery.EPISODE_PUBLISHED_AT);
            final String episodeUrl = cursor.getString(EpisodesQuery.EPISODE_URL);
            final int stateId = cursor.getInt(EpisodesQuery.EPISODE_STATE_ID);

                        ((TextView) view.findViewById(R.id.title)).setText(title);
                        ...... 
                }
}

Some thoughts what can be causing this problem?

2

There are 2 best solutions below

0
On

I think I got it. One column in cursor contains some blob data. When I removed this column from query selection, it scroll up smoothly. Thanks for all answers.

1
On

ListView empty if SimpleCursorAdapter closed(). This link might answer of where to close cursor. If it scrolls down smoothly i see no reason for freezing when scrolling up. I am curious about the problem your facing.