@LuxuryMode, ListView onItemClick. :
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long rowId) {
}
:
if (position == 0) { )
:
if (position == adapter.getCount()) { ) // if there is no header
if (position == adapter.getCount() + 1) { ) // if there is a header
. , :
arrayList.size() // number of items in the array (if your adapter is using an array)
cursor.getCount() // number of data items in the cursor (if your adapter is using a cursor)
adapter.getCount() // number of data items passed in by the cursor (or at least that is what a custom adapter should report)
listview.getCount() // number of data items from the adapter + a header and/or footer view
So using a header or footer will make listview.getCount () more by 1 than cursor.getCount (). If you use both the header and footer, it will be 2 more.
source
share