title: expandlelistview child click
body: <p>I have an expandle listview witha few children. If i click a child i want it to open it own activity. Right now i got it to work to go to 1 activity only. So when for example when i click on Mambo beach i want it to open an activity with the information of Mambo beach. And when i click on Avis car Rental it should open that acitivity</p>
  
  <p>below my example:</p>
  
  <p>public class TodoFragment extends Fragment {</p>
  
  <pre><code>public TodoFragment(){}
  
  ExpandableListAdapter listAdapter;
  ExpandableListView expListView;
  List&lt;String&gt; listDataHeader;
  HashMap&lt;String, List&lt;String&gt;&gt; listDataChild;
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
      return inflater.inflate(R.layout.fragment_todo,container, false);
  }
  @Override
  public void onStart() {
      super.onStart();
  
      // get the listview
      expListView = (ExpandableListView) getView().findViewById(R.id.lvExp);
  
      // preparing list data
      prepareListData();
  
      listAdapter = new ExpandableListAdapter(getActivity(), listDataHeader, listDataChild);
  
  
      // setting list adapter
      expListView.setAdapter(listAdapter);
  
      // Listview Group click listener
      expListView.setOnGroupClickListener(new OnGroupClickListener() {
  
          @Override
          public boolean onGroupClick(ExpandableListView parent, View v,
                  int groupPosition, long id) {
              // Toast.makeText(getApplicationContext(),
              // "Group Clicked " + listDataHeader.get(groupPosition),
              // Toast.LENGTH_LONG).show();
              return false;
          }
      });
  
      // Listview on child click listener
      expListView.setOnChildClickListener(new OnChildClickListener() {
  
          @Override
          public boolean onChildClick(ExpandableListView parent, View v,
                  int groupPosition, int childPosition, long id) {
              //You have to create next activity say NextActivity.java
              Intent intent = new Intent(getActivity(), MainActivity.class); 
              startActivity(intent);
              return false;
          }
      });
  
  }
  
  /*
   * Preparing the list data
   */
  private void prepareListData() {
      listDataHeader = new ArrayList&lt;String&gt;();
      listDataChild = new HashMap&lt;String, List&lt;String&gt;&gt;();
  
      // Adding group data
      listDataHeader.add("Culture");
      listDataHeader.add("Beaches");
      listDataHeader.add("Car Rental");
      listDataHeader.add("Dinner");
  
      // Adding child data
      List&lt;String&gt; culture= new ArrayList&lt;String&gt;();
  
      culture.add("Grotten van Hato");
      culture.add("Ostrich Farm");
      culture.add("Shete Boka national Park");
      culture.add("Landhuis Knip");
      culture.add("Christoffelpark");
      culture.add("Navy Museum");
      culture.add("Post Museum");
  
      List&lt;String&gt; beaches = new ArrayList&lt;String&gt;();
      beaches.add("Mambo Beach");
      beaches.add("Knip");
      beaches.add("Playa Kalki");
      beaches.add("Westpunt");
      beaches.add("Boca Santa Cruz");
      beaches.add("Cas Abao");
      beaches.add("Playa PortoMari");
      beaches.add("Kontiki Beach");
      beaches.add("Jan Thiel Beach");
  
      List&lt;String&gt; car = new ArrayList&lt;String&gt;();
      car.add("budget rental");
      car.add("Avis Rental");
      car.add("Alamo Car Rental");
      car.add("Noordstar Rental");
      car.add("Europa Rental");
  
      List&lt;String&gt; dinner = new ArrayList&lt;String&gt;();
      dinner.add("Truk di Pan");
      dinner.add("Burger King");
      dinner.add("Punda Food");
  
   // Header, Child data
      listDataChild.put(listDataHeader.get(0), culture); 
      listDataChild.put(listDataHeader.get(1), beaches);
      listDataChild.put(listDataHeader.get(2), car);
      listDataChild.put(listDataHeader.get(3), dinner);
  
  }
  </code></pre>
  
  <p>}</p>