Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Onur Ozbek
Onur Ozbek
Courses Plus Student 2,451 Points

setOnChildClickListener does not work

I'm trying to use Intent in my ExpandableListView.setOnChildClickListener to launch another activity but it doesn't work. I went through stackoverflow but the solutions did not relate to my problem. The following is my code:

    protected void onCreate(Bundle savedInstanceState) {
        //code omitted to make it shorter
        expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
            public boolean onChildClick(ExpandableListView expandableListView,
                                        View view,
                                        int groupPosition,
                                        int childPosition,
                                        long id) {
                return true;


    public void activityStartIntent(){
        Intent intent = new Intent(MainActivity.this, AssignmentActivity.class);

And yes I did put the return type to true in isChildSelectable method:

    public boolean isChildSelectable(int groupPosition, int childPosition) {
        return true;

I don't have any clickable or focusable attributes in my XML files. Despite all of this, I still cannot get my children onClick to work.