Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if a view is visible in a ListView?

I want to be able to tell if a view is visible in my listview, which is populated by a custom CursorAdapter. How can I do this?

like image 568
Christopher Perry Avatar asked Aug 20 '10 17:08

Christopher Perry


People also ask

How do I know if a widget is visible?

Close the current screen via finish() like in Android. Check if the widget is currently visible using bool isVisible() .

How check ListView is empty?

just check if (cartlist. size()<0) then yours list is Empty.!

How does ListView work?

Android ListView is a ViewGroup that is used to display the list of items in multiple rows and contains an adapter that automatically inserts the items into the list. The main purpose of the adapter is to fetch data from an array or database and insert each item that placed into the list for the desired result.


1 Answers

You can check whether a given position is visible, using getFirstVisiblePosition() and getChildCount().

like image 51
Romain Guy Avatar answered Oct 09 '22 01:10

Romain Guy