Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 601
olegflo Avatar asked Jun 22 '12 08:06

olegflo


People also ask

How do you connect an Adapter with ListView write down the codes for it?

Attaching the Adapter to a ListView // Construct the data source ArrayList<User> arrayOfUsers = new ArrayList<User>(); // Create the adapter to convert the array to views UsersAdapter adapter = new UsersAdapter(this, arrayOfUsers); // Attach the adapter to a ListView ListView listView = (ListView) findViewById(R. id.

How check ListView is empty?

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

Which method is used to obtain the selected option from a ListView?

To get which item was selected, there is a method of the ListView called getItemAtPosition.


1 Answers

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

int last = listView1.getLastVisiblePosition();  

int first = listView1.getFirstVisiblePosition();
like image 117
Dheeresh Singh Avatar answered Sep 22 '22 22:09

Dheeresh Singh