Java – Extensible ListView setOnChildClickListener problem

Extensible ListView setOnChildClickListener problem… here is a solution to the problem.

Extensible ListView setOnChildClickListener problem

I’m developing an application with an extensible ListView and getting display data well in this ListView, but the problem is setOnChildClickListener doesn’t work. There are no interactive widgets (checkboxes or edittex) that cause focus issues, we need to fake focus, no, I only adopted Texview in parent and child lists. I’ve also tried doing all texview focusable as false without success. Can you fix this

Code:

mlvInstructionlist = (ExpandableListView)amviInstruction. findViewById(R.id.lvInsListofInstruction);
        AssetsWiseInstructionListAdapter adapter = new AssetsWiseInstructionListAdapter(getActivity(),mlvInstructionlist, mlstGroupCollection);

mlvInstructionlist.setAdapter(adapter);
        mlvInstructionlist.setOnChildClickListener(this);
@Override
    public boolean onChildClick(ExpandableListView parent, View v,
            int groupPosition, int childPosition, long id) {
         TODO Auto-generated method stub

Toast.makeText(getSherlockActivity(), "Child click Header",Toast.LENGTH_LONG).show();
         AppLog.showLogI(TAG, "Child click Header");
        return true;
    }

Solution

You can try replacing listView with scrollView. This should fix it or try quoting this article: Focusable EditText inside ListView .

This discusses setting up onClick and focusable for future generations.

Related Problems and Solutions