EditText content inside ExpandableListView disappear when clicking next ExpandableListView header
<p>I have an <code>edittext</code> inside an <code>expandablelistview</code> item child. Then, I entered a text inside this <code>edittext</code>, but whenever I click other <code>expandablelistview</code> header, the text I entered disappear.</p>

<p>I already used <code>android:windowSoftInputMode="adjustPan"</code> inside my Manifest.xml and many other possible fixes, but didn't work.</p>

<p>this is my adapter:</p>

<pre><code>public class ExpendableAdapter extends BaseExpandableListAdapter {
    private Context _context;
    private List&lt;String&gt; _listDataHeader;
    private HashMap&lt;String, List&lt;ExpandItemModel&gt;&gt; _listDataChild;

public ExpendableAdapter(Context context, List&lt;String&gt; listDataHeader,
                             HashMap&lt;String, List&lt;ExpandItemModel&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(final int groupPosition, final int childPosition,
                         boolean isLastChild, View convertView, ViewGroup parent) {

    final ExpandItemModel childText = (ExpandItemModel) getChild(groupPosition, childPosition);

    if (convertView == null) {
        LayoutInflater infalInflater = (LayoutInflater) this._context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = infalInflater.inflate(R.layout.list_item, null);
    }

    final EditText etTotal = (EditText)convertView
            .findViewById(R.id.et_total);

    etTotal.setText(childText.getTotal);

    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 tvHeader = (TextView) convertView
            .findViewById(R.id.tv_header);
    tvHeader.setTypeface(null, Typeface.BOLD);
    tvHeader.setText(headerTitle);

    return convertView;
}

@Override
public boolean hasStableIds() {
    return true;
}


@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
    return true;
}
}
</code></pre>

<p>And this is the layout:</p>

<pre><code>&lt;RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/rl_expen_but"
        android:layout_below="@+id/rl_ats_draft2"
        android:layout_above="@+id/selanjutnya"
        &gt;



        &lt;ExpandableListView
            android:background="@color/cardview_light_background"
            android:id="@+id/lvExp"
            android:descendantFocusability="beforeDescendants"
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:animateLayoutChanges="true"/&gt;

        &lt;View
            android:layout_below="@+id/lvExp"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#bebebe"/&gt;

    &lt;/RelativeLayout&gt;
</code></pre>

<p>Is there something wrong I did with above codes? Thank you.</p>

<p><strong>EDIT:</strong></p>

<p>This is how my code looks like after I edited it as suggested by chandil03. The expandablelistview no longer refreshes when I expand headers. But strangely, when I typed values in edittext at groupposition 0 and child position 0, then in some other edittext in different goupposition and childposition appear the same exact values I typed at previous edittext. Or even stranger, the values at previous edittext sometimes dissapeared. </p>

<pre><code>static class ViewHolder {
    protected View et;

    public void addView(View et){
        this.et = et;
    }
}

       @Override
       public View getChildView(final int groupPosition, final int childPosition,
                     boolean isLastChild, View convertView, ViewGroup parent) {

       final ExpandItemModel childText = (ExpandItemModel) getChild(groupPosition, childPosition);

       ViewHolder viewHolder;

       if (convertView == null) {
           LayoutInflater infalInflater = (LayoutInflater) this._context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
           convertView = infalInflater.inflate(R.layout.list_item, null);
           viewHolder = new ViewHolder();
           viewHolder.addView(convertView
                .findViewById(R.id.et_total));
           convertView.setTag(viewHolder);
       }else{
           viewHolder = (ViewHolder)convertView.getTag();
       }

       final EditText etTotal = (EditText)convertView
        .findViewById(R.id.et_total);

       etTotal.setText(childText.getTotal);

       return convertView;
  }
</code></pre>