how to know from adapter if the item of ListView is visible or not?

olegflo picture olegflo · Jun 22, 2012 · Viewed 13k times · Source

I have an adapter that connected to ListView, e.g.

mJournalAdapter = new JournalAdapter();
journalEntryList.setAdapter(mJournalAdapter);

and I want to know inside of my JournalAdapter if some view (item of ListView) is visible or not, is it possible?

Answer

Dheeresh Singh picture Dheeresh Singh · Jun 22, 2012

If you know the postion of that item then you can use

int last = listView1.getLastVisiblePosition();  

int first = listView1.getFirstVisiblePosition();