@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_demo1, container, false); ((TextView) rootView.findViewById(R.id.sample1).findViewById(R.id.title)).setText("Sample 1"); ((TextView) rootView.findViewById(R.id.sample2).findViewById(R.id.title)).setText("Sample 2"); ExpandableTextView expTv1 = (ExpandableTextView) rootView.findViewById(R.id.sample1) .findViewById(R.id.expand_text_view); ExpandableTextView expTv2 = (ExpandableTextView) rootView.findViewById(R.id.sample2) .findViewById(R.id.expand_text_view); expTv1.setOnExpandStateChangeListener(new ExpandableTextView.OnExpandStateChangeListener() { @Override public void onExpandStateChanged(TextView textView, boolean isExpanded) { Toast.makeText(getActivity(), isExpanded ? "Expanded" : "Collapsed", Toast.LENGTH_SHORT).show(); } }); expTv1.setText(getString(R.string.dummy_text1)); expTv2.setText(getString(R.string.dummy_text2)); return rootView; } }