title: Android: ExpandableListView ChildClickListener not working after list scroll
body: <p>I have created a <code>ExpandableListView</code> Search Activity which shows 3 groups - <em>Tracks, Artists, Albums</em>.
  As the user types text in <code>EditText</code>, the corresponding search results are displayed in ExpandableListView.</p>
  
  <p><strong>PROBLEM:</strong>
  When the user clicks on any child item, I want to perform some operation. At first this function is working fine, but when I scroll the list up or down, the <code>OnChildClickListener</code> stops working. And no child gets selected on click.</p>
  
  <p>Is this a problem with the view update &amp; positions?</p>
  
  <p>NOTE: I'm using <code>BaseExpandableListAdapter</code></p>
  
  <p>Here is the code: (I've pasted what I've thought was necessary. Plz let me know if other part is required):</p>
  
  <pre><code>    protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.search);
  
              etSearchBar = (EditText) findViewById(R.id.etSearchBar);
              etSearchBar.addTextChangedListener(this);
  
              lvExpSearchResult = (ExpandableListView) findViewById(R.id.lvExpSearchResult);
              lvExpSearchResult.setGroupIndicator(null);
              lvExpSearchResult.setChildIndicator(null);
              lvExpSearchResult.setOnTouchListener(this);
              lvExpSearchResult.setOnChildClickListener(this);
          }
  
      @Override
          public boolean onChildClick(ExpandableListView parent, View view, int groupPosition,
                  int childPosition, long id) {
              lvExpSearchResult.smoothScrollToPosition(groupPosition);
              Toast.makeText(SearchActivity.this, group[groupPosition], Toast.LENGTH_SHORT).show();
              //Toast.makeText(SearchActivity.this, children[groupPosition][childPosition], Toast.LENGTH_LONG).show();
              return true;
          }
  
  @Override
      public void onTextChanged(CharSequence s, int start, int before, int count) {
          if (s.length() &gt; 0) {
              group = new String[] { "Tracks", "Albums", "Artists" };
              ArrayList&lt;String&gt; result = null;
  
              result = getQueryResult(MediaStore.Audio.Media.TITLE);
              result = new Utilities().removeDuplicatesAL(result);
              String[] tracks = result.toArray(new String[result.size()]);
  
              result = getQueryResult(MediaStore.Audio.Media.ALBUM);
              result = new Utilities().removeDuplicatesAL(result);
              String[] albums = result.toArray(new String[result.size()]);
  
              result = getQueryResult(MediaStore.Audio.Media.ARTIST);
              result = new Utilities().removeDuplicatesAL(result);
              String[] artists = result.toArray(new String[result.size()]);
  
              children = new String[][] { tracks, albums, artists };
  
              adapter = new SearchAdapter(this, group, children);
          } else {
              adapter = new SearchAdapter(this, new String[0], new String[0][0]);
          }
      }
  
      @Override
      public void afterTextChanged(Editable s) {
          lvExpSearchResult.setAdapter(adapter);
      }
  
  // BaseExpandableListAdapter code - getGroupView &amp; getChildView
  @Override
      public View getChildView(int groupPosition, int childPosition,
              boolean isLastChild, View convertView, ViewGroup parent) {
          TextView childRow = (TextView) convertView;
          if (childRow == null) {
              LayoutInflater inflator = (LayoutInflater) context
                      .getSystemService(context.LAYOUT_INFLATER_SERVICE);
              try {
                  childRow = (TextView) inflator.inflate(
                          android.R.layout.simple_expandable_list_item_1, null);
              } catch (Exception e) {
                  Toast.makeText(context, e.toString(), Toast.LENGTH_SHORT)
                          .show();
              }
          }
          childRow.setText(children[groupPosition][childPosition]);
          return childRow;
      }
  
  @Override
      public View getGroupView(int groupPosition, boolean isExpanded,
              View convertView, ViewGroup parent) {
          TextView headerRow = (TextView) convertView;
          if (headerRow == null) {
              LayoutInflater inflator = (LayoutInflater) context
                      .getSystemService(context.LAYOUT_INFLATER_SERVICE);
              headerRow = (TextView) inflator.inflate(
                      android.R.layout.simple_expandable_list_item_1, null);
          }
          headerRow.setTypeface(Typeface.DEFAULT_BOLD);
          headerRow.setText(group[groupPosition]);
  
          ExpandableListView eLV = (ExpandableListView)parent;
          eLV.expandGroup(groupPosition);
  
          return headerRow;
      }
  </code></pre>