title: Listeners are not working in Expandablelistview in case of fragment
body: <p>None of the listeners are working in expandablelistview when clicked on items in case of fragments but when used in activity all works fine.No errors are generated.View is displayed correctly.Please solve this problem.Thank u</p>
  
  <pre><code>**Fragment1.java**
  public class Fragement1 extends Fragment{
  TextView text;
      Toolbar toolbar;
      android.widget.ExpandableListAdapter listAdapter;
      ExpandableListView expListView;
      List&lt;String&gt; listDataHeader;
      HashMap&lt;String, List&lt;String&gt;&gt; listDataChild;
      @Nullable
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          View view=inflater.inflate(R.layout.layout_fragment_one,container,false);
          final String branch=this.getArguments().getString("branch");
          toolbar=(Toolbar)view.findViewById(R.id.nav_action);
          //casting is neccessary beacase getActivity returns FragmentActivity and we need appcomatact...
          //((AppCompatActivity)getActivity()).setSupportActionBar(toolbar);
           //setHasOptionsMenu(true);
  
          text=(TextView)view.findViewById(R.id.textView3);
          text.setText(branch);
          //((AppCompatActivity)getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
          // get the listview
          expListView = (ExpandableListView) view.findViewById(R.id.lvExp);
  
          // preparing list data
          prepareListData();
  
          listAdapter = new ExpandableListAdapter(getActivity().getApplicationContext(),listDataHeader, listDataChild);
  
          // setting list adapter
  
              expListView.setAdapter(listAdapter);
  
  
          // Listview Group click listener
          expListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
  
              @Override
              public boolean onGroupClick(ExpandableListView parent, View v,
                                          int groupPosition, long id) {
                   Toast.makeText(getActivity(),
                   "Group Clicked " + listDataHeader.get(groupPosition),
                   Toast.LENGTH_SHORT).show();
                  return false;
              }
          });
  
          // Listview Group expanded listener
          expListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
  
              @Override
              public void onGroupExpand(int groupPosition) {
                Toast.makeText(getActivity().getApplicationContext(),
                          listDataHeader.get(groupPosition) + " Expanded",
                          Toast.LENGTH_SHORT).show();
              }
          });
  
          // Listview Group collasped listener
          expListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
  
              @Override
              public void onGroupCollapse(int groupPosition) {
                 Toast.makeText(getActivity(),
                          listDataHeader.get(groupPosition) + " Collapsed",
                          Toast.LENGTH_SHORT).show();
  
              }
          });
  
          // Listview on child click listener
          expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
  
              @Override
              public boolean onChildClick(ExpandableListView parent, View v,
                                          int groupPosition, int childPosition, long id) {
                  Log.d("Clicked","clikkkked");
                  // TODO Auto-generated method stub
                  String subject =listDataHeader.get(groupPosition);
                  String chapter =listDataChild.get(listDataHeader.get(groupPosition)).get(childPosition);
                  ChapterContentFetcherFragment chapterContentFetcherFragment = new ChapterContentFetcherFragment();
                  Bundle args=new Bundle();
                  args.putString("branch",branch);
                  args.putString("subject",subject);
                  args.putString("chapter",chapter);
  
                  chapterContentFetcherFragment.setArguments(args);
                  Toast.makeText(
                          getActivity().getApplicationContext(),
                          listDataHeader.get(groupPosition)
                                  + " : "
                                  + listDataChild.get(
                                  listDataHeader.get(groupPosition)).get(
                                  childPosition), Toast.LENGTH_SHORT)
                          .show();
  
  
                  return false;
              }
          });
          return view;
      }
  
      /*
       * Preparing the list data
       */
      private void prepareListData() {
          listDataHeader = new ArrayList&lt;String&gt;();
          listDataChild = new HashMap&lt;String, List&lt;String&gt;&gt;();
  
          // Adding header data
          listDataHeader.add("Top 250");
          listDataHeader.add("Now Showing");
          listDataHeader.add("Coming Soon..");
  
          // Adding child data
          List&lt;String&gt; top250 = new ArrayList&lt;String&gt;();
          top250.add("The Shawshank Redemption");
          top250.add("The Godfather");
          top250.add("The Godfather: Part II");
          top250.add("Pulp Fiction");
          top250.add("The Good, the Bad and the Ugly");
          top250.add("The Dark Knight");
          top250.add("12 Angry Men");
  
          List&lt;String&gt; nowShowing = new ArrayList&lt;String&gt;();
          nowShowing.add("The Conjuring");
          nowShowing.add("Despicable Me 2");
          nowShowing.add("Turbo");
          nowShowing.add("Grown Ups 2");
          nowShowing.add("Red 2");
          nowShowing.add("The Wolverine");
  
          List&lt;String&gt; comingSoon = new ArrayList&lt;String&gt;();
          comingSoon.add("2 Guns");
          comingSoon.add("The Smurfs 2");
          comingSoon.add("The Spectacular Now");
          comingSoon.add("The Canyons");
          comingSoon.add("Europa Report");
  
          listDataChild.put(listDataHeader.get(0), top250); // Header, Child data
          listDataChild.put(listDataHeader.get(1), nowShowing);
          listDataChild.put(listDataHeader.get(2), comingSoon);
      }
  
  
  
      @Override
      public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
          super.onCreateOptionsMenu(menu, inflater);
          inflater.inflate(R.menu.menu,menu);
      }
  
  **DashboardActivity.java**
  Im replacing it with fragment fragment1.
  
  public class DashboardActivity extends AppCompatActivity {
    private TextView branchView;
      ExpandableListAdapter listAdapter;
      ExpandableListView expListView;
      List&lt;String&gt; listDataHeader;
      HashMap&lt;String, List&lt;String&gt;&gt; listDataChild;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_dashboard);
          Bundle bundle= getIntent().getExtras();
          final String branch= bundle.getString("branch");
          branchView =(TextView) findViewById(R.id.branch);
  
          switch (branch)
          {
              case "computer":
                  branchView.setText(branch);
                  Fragement1 comp_fragment=new Fragement1();
                  comp_fragment.setArguments(bundle);
                  getFragmentManager().beginTransaction().replace(R.id.dashboard,comp_fragment).addToBackStack(null).commit();
  
              case "electronics":
                  branchView.setText(branch);
                  Electronics_Fragment extc_frag=new Electronics_Fragment();
                  extc_frag.setArguments(bundle);
                  getFragmentManager().beginTransaction().replace(R.id.dashboard,extc_frag).commit();
  
              case "electrical":
                  branchView.setText(branch);
                  Electrical_Fragment electrical_fragment=new Electrical_Fragment();
                  electrical_fragment.setArguments(bundle);
                  getFragmentManager().beginTransaction().replace(R.id.dashboard,electrical_fragment).commit();
              case "chemical":
                  branchView.setText(branch);
                  Chemical_Fragment chemical_fragment=new Chemical_Fragment();
                  chemical_fragment.setArguments(bundle);
                  getFragmentManager().beginTransaction().replace(R.id.dashboard,chemical_fragment).commit();
  
              case "civil":
                  branchView.setText(branch);
                  Civil_Fragment civil_fragment=new Civil_Fragment();
                  civil_fragment.setArguments(bundle);
                  getFragmentManager().beginTransaction().replace(R.id.dashboard,civil_fragment).commit();
  
              case "mechanical":
                  branchView.setText(branch);
                  Mechanical_Fragment mechanical_fragment=new Mechanical_Fragment();
                  mechanical_fragment.setArguments(bundle);
                  getFragmentManager().beginTransaction().replace(R.id.dashboard,mechanical_fragment).commit();
          }
  
  **layout_fragment_one.xml**
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical" android:layout_width="match_parent"
      android:layout_height="match_parent"
      &gt;
  
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="New Text"
          android:layout_marginTop="40dp"
          android:id="@+id/textView3" /&gt;
  
      &lt;ExpandableListView
          android:id="@+id/lvExp"
          android:layout_height="match_parent"
          android:layout_width="match_parent"
          android:cacheColorHint="#00000000"/&gt;
  
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/recyclerView"
          android:layout_width="match_parent"
          android:paddingTop="10dp"
          android:layout_height="match_parent"&gt;&lt;/android.support.v7.widget.RecyclerView&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>//Adapter class</strong></p>
  
  <p>public class ExpandableListAdapter extends BaseExpandableListAdapter {</p>
  
  <pre><code>private Context _context;
  private List&lt;String&gt; _listDataHeader; // header titles
  // child data in format of header title, child title
  private HashMap&lt;String, List&lt;String&gt;&gt; _listDataChild;
  
  public ExpandableListAdapter(Context context, List&lt;String&gt; listDataHeader,
          HashMap&lt;String, List&lt;String&gt;&gt; listChildData) {
      this._context = context;
      this._listDataHeader = listDataHeader;
      this._listDataChild = listChildData;
  }
  
  @Override
  public Object getChild(int groupPosition, int childPosititon) {
      return this._listDataChild.get(this._listDataHeader.get(groupPosition))
              .get(childPosititon);
  }
  
  @Override
  public long getChildId(int groupPosition, int childPosition) {
      return childPosition;
  }
  
  @Override
  public View getChildView(int groupPosition, final int childPosition,
          boolean isLastChild, View convertView, ViewGroup parent) {
  
      final String childText = (String) getChild(groupPosition, childPosition);
  
      if (convertView == null) {
          LayoutInflater infalInflater = (LayoutInflater) this._context
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          convertView = infalInflater.inflate(R.layout.list_item, null);
      }
  
      TextView txtListChild = (TextView) convertView
              .findViewById(R.id.lblListItem);
  
      txtListChild.setText(childText);
      return convertView;
  }
  
  @Override
  public int getChildrenCount(int groupPosition) {
      return this._listDataChild.get(this._listDataHeader.get(groupPosition))
              .size();
  }
  
  @Override
  public Object getGroup(int groupPosition) {
      return this._listDataHeader.get(groupPosition);
  }
  
  @Override
  public int getGroupCount() {
      return this._listDataHeader.size();
  }
  
  @Override
  public long getGroupId(int groupPosition) {
      return groupPosition;
  }
  
  @Override
  public View getGroupView(int groupPosition, boolean isExpanded,
          View convertView, ViewGroup parent) {
      String headerTitle = (String) getGroup(groupPosition);
      if (convertView == null) {
          LayoutInflater infalInflater = (LayoutInflater) this._context
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          convertView = infalInflater.inflate(R.layout.list_group, null);
      }
  
      TextView lblListHeader = (TextView) convertView
              .findViewById(R.id.lblListHeader);
      lblListHeader.setTypeface(null, Typeface.BOLD);
      lblListHeader.setText(headerTitle);
  
      return convertView;
  }
  
  @Override
  public boolean hasStableIds() {
      return false;
  }
  
  @Override
  public boolean isChildSelectable(int groupPosition, int childPosition) {
      return true;
  }
  </code></pre>
  
  <p>}</p>