title: How to add multiple Textviews in a ExpandableListView
body: <p>I can't figure out how to add more than one Textview in my Expandablelist adapter and MainActivty.  When ever I tried to add a new Textview in the Adapter, I then can't figure out how to initialize  the Textview in the MainAcivity.  It just copies the text that I put in the first Textview into the new one.   I found some other Stackoverflow posts that regarded this but none of the them has the answer.  If someone has any idea how to do this, I'd appreciate it.  Please put a example as I'm a beginner with this.  I followed a tutorial from this <a href="http://www.tutorialsbuzz.com/2014/07/custom-expandable-listview-image-text.html" rel="nofollow">http://www.tutorialsbuzz.com/2014/07/custom-expandable-listview-image-text.html</a></p>
  
  <p>Also see a couple comments in my code to see what I want done.</p>
  
  <p>ExpandablelistAdapter:</p>
  
  <pre><code>import android.view.LayoutInflater;
  
  
                  import android.content.Context;
  
                  import android.view.View;
                  import android.view.ViewGroup;
                  import android.widget.BaseExpandableListAdapter;
                  import android.widget.ImageView;
                  import android.widget.TextView;
  
          import java.util.ArrayList;
  
          public class ExpandListAdapter extends BaseExpandableListAdapter {
  
              private Context context;
              private ArrayList&lt;Group&gt; groups;
  
              public ExpandListAdapter(Context context, ArrayList&lt;Group&gt; groups) {
                  this.context = context;
                  this.groups = groups;
  
              }
  
              @Override
              public Object getChild(int groupPosition, int childPosition) {
                  ArrayList&lt;Child&gt; chList = groups.get(groupPosition).getItems();
                  return chList.get(childPosition);
  
              }
  
              @Override
              public long getChildId(int groupPosition, int childPosition) {
                  return childPosition;
              }
  
              @Override
              public View getChildView(int groupPosition, int childPosition,
                                       boolean isLastChild, View convertView, ViewGroup parent) {
  
                  Child child = (Child) getChild(groupPosition, childPosition);
                  if (convertView == null) {
                      LayoutInflater infalInflater = (LayoutInflater) context
                              .getSystemService(context.LAYOUT_INFLATER_SERVICE);
                      convertView = infalInflater.inflate(R.layout.child_item, null);
  
                  }
                  TextView tv = (TextView) convertView.findViewById(R.id.country_name);
  //trying to add this textview ltv
                  TextView ltv = (TextView) convertView.findViewById(R.id.large_text);
                  ImageView iv = (ImageView) convertView.findViewById(R.id.flag);
                  tv.setText(child.getName().toString());
                  iv.setImageResource(child.getImage());
                  ltv.setText(child.getName().toString());
  
  
  
  
  
  
  
  
  
  
  
  
                      return convertView;
              }
  
              @Override
              public int getChildrenCount(int groupPosition) l
  
              @Override
              public Object getGroup(int groupPosition) {
                  return groups.get(groupPosition);
              }
  
              @Override
              public int getGroupCount() {
                  return groups.size();
              }
  
              @Override
              public long getGroupId(int groupPosition) {
                  return groupPosition;
              }
  
              @Override
              public View getGroupView(int groupPosition, boolean isExpanded,
                                       View convertView, ViewGroup parent) {
                  Group group = (Group) getGroup(groupPosition);
                  if (convertView == null) {
                      LayoutInflater inf = (LayoutInflater) context
                              .getSystemService(context.LAYOUT_INFLATER_SERVICE);
                      convertView = inf.inflate(R.layout.group_item, null);
                  }
                  TextView tv = (TextView) convertView.findViewById(R.id.group_name);
                  tv.setText(group.getName());
                  return convertView;
              }
  
              @Override
              public boolean hasStableIds() {
                  return true;
              }
  
              @Override
              public boolean isChildSelectable(int groupPosition, int childPosition) {
                  return true;
              }
  
          }
  </code></pre>
  
  <p>MainActivity:</p>
  
  <pre><code>    import java.util.ArrayList;
              import java.util.Set;
  
              import android.app.Activity;
              import android.content.Intent;
              import android.os.Bundle;
  
              import android.view.View;
              import android.widget.Button;
              import android.widget.ExpandableListView;
  
  
  
  
  
              public class Brandspage extends Activity {
  
                  private ExpandListAdapter ExpAdapter;
                  private ExpandableListView ExpandList;
                  private ArrayList&lt;Group&gt; ExpListItems;
  
  
                  @Override
                  protected void onCreate(Bundle savedInstanceState) {
                      super.onCreate(savedInstanceState);
                      setContentView(R.layout.activity_brandspage);
                      Button b1 = (Button) findViewById(R.id.button4);
                      b1.setOnClickListener(new View.OnClickListener() {
  
  
                          @Override
                          public void onClick(View v) {
                              Intent i = new Intent(Brandspage.this, MainActivity.class);
                              startActivity(i);
  
                          }
                      });
  
  
                      ExpandList = (ExpandableListView) findViewById(R.id.exp_list);
                      ExpListItems = SetStandardGroups();
                      ExpAdapter = new ExpandListAdapter(Brandspage.this, ExpListItems);
                      ExpandList.setAdapter(ExpAdapter);
  
  
                  }
  
  
                  public ArrayList&lt;Group&gt; SetStandardGroups() {
  
  //how to initialize the ltv textview here with the other strings 
  
  
                      String group_names[] = {"A-G", "H-N", "O-U", "V-Z"
                      };
  
  
                      String country_names[] = {
  
                              " " +
  
                                      "\n" +
                                      "\n" +
                                      "  \n" +
                                      "\n" +
                                      "\n" +
                                      "\n" +
                                      "  \n" +
                                      "\n" +
                                      " \n" +
                                      "\n" +
                                      " \n "
  
                                     };
  
  
  
  
                      int Images[] = {R.drawable.ic_launcher, R.drawable.ic_launcher,
                              R.drawable.ic_launcher, R.drawable.ic_launcher
  
  
                      };
  
  
                      ArrayList&lt;Group&gt; list = new ArrayList&lt;Group&gt;();
  
                      ArrayList&lt;Child&gt; ch_list;
  
                      int size = 20;
                      int j = 0;
  
  
                      for (String group_name : group_names) {
                          Group gru = new Group();
                          gru.setName(group_name);
  
  
  
  
  
                              ch_list = new ArrayList&lt;Child&gt;();
                              for (; j &lt; size; j++) {
                                  Child ch = new Child();
                                  ch.setName(country_names[j]);
  
  
                                  ch.setImage(Images[j]);
                                  ch_list.add(ch);
  
  
                              }
                              gru.setItems(ch_list);
                              list.add(gru);
  
                              size = size + 20;
                          }
  
                          return list;
  
  
                      }
  
  
                  }
  </code></pre>
  
  <p>child item.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingTop="4dp"
      android:paddingBottom="4dp"
      android:layout_marginLeft="50dp"
      &gt;
  
      &lt;TextView
          android:id="@+id/country_name"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="TextView"
          android:textSize="20dp"
          android:layout_below="@+id/large_text"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginTop="66dp" /&gt;
  
      &lt;ImageView
          android:id="@+id/flag"
          android:layout_width="fill_parent"
          android:layout_height="100dp"
          android:src="@drawable/ic_launcher"
  
          android:layout_alignParentTop="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true" /&gt;
  
  
      //Want this Large Text to be in the ExpandableListView
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textAppearance="?android:attr/textAppearanceLarge"
              android:text="Large Text"
              android:id="@+id/large_text"
              android:layout_below="@+id/flag"
              android:layout_alignParentLeft="true"
              android:layout_alignParentStart="true" /&gt;
  
      &lt;/RelativeLayout&gt;
  </code></pre>