Here is my whole activity code, if nessery I can post my xml as well.
public class Main_Activityextends AppCompatActivity {
private RecyclerView recyclerview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
recyclerview = (RecyclerView) findViewById(R.id.recyclerview);
recyclerview.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
List<ExpandableListViewAdapter.Item> data = new ArrayList<>();
data.add(new ExpandableListViewAdapter.Item(ExpandableListViewAdapter.HEADER, "Terms of usage"));
data.add(new ExpandableListViewAdapter.Item(ExpandableListViewAdapter.CHILD, "never eat"));
data.add(new ExpandableListViewAdapter.Item(ExpandableListViewAdapter.CHILD, "bluhhhhh"));
recyclerview.setAdapter(new ExpandableListViewAdapter(data));
recyclerview.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
return true;
}
});
The code works perfectly without the clickListener
, but I want an action to happen when clicking on a certain child of the array but right now it says Cannot resolve method setOnChildClickListener(anonymous android.widget.ExpendableListView.OnChildClickListener)
although The recycleView
is my Adapter
, any help will be appreciated