So I\'m trying to set up a setOnClickListener for my ListView but it\'s causing a crash in my program for some reason when I try... I\'m quite new
firstly set the value inside your main activity where your using your listview:
new android.widget.AdapterView.OnItemClickListener()
in place of adapter of your listview:
new AdapterView.OnItemClickListener()
So finally it looks like:
this.listView.setItemsCanFocus(false);
this.listView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() {
@Override
public void onItemClick(android.widget.AdapterView> parent, View view, int position, long id) {
}
when you are using any custom view to populate the data inside listview.
Then in your main Activity file.xml in the parent layout{ inside which listview is there} set this option:
android:descendantFocusability="blocksDescendants"
and if you are using any buttons/textview inside listview, set this property on that textview/button:
android:focusable="false"
android:focusableInTouchMode="false"
For scroll option in your listview just add this line inside activity:
listView=(ListView)findViewById(R.id.container);
listView.setNestedScrollingEnabled(true);
As per i understood i am giving answer, and i hope it will help, if anyone found some corrections or helpful, they are welcome.