1

I have different layout xml for listview and header. I have pointed to listview layout file in my fragment page and declare setItemOnClickListener on that listview to get the data display when clicked on its' item. However, when I clicked the child items, they are not working and they working when I clicked on header section. Can someone tell me what is probably goes wrong?

sample picture

This is my code which I believe is the most basic one. The different will be just in fragment compare to normal activity pages.

 ListView lv = (ListView) myView.findViewById(R.id.listview);
 lv.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position,
                long id) {
            Toast.makeText(getActivity(), "This is my Toast message!",Toast.LENGTH_LONG).show();
        }
    });
Jin Sheng
  • 27
  • 1
  • 7

0 Answers0