title: OnItemClickListener not working with AutoCompleteTextView
body: <p>I used an autoCompleteTextView with customLayout and Adapter, but the issue is when we click on an item in suggestions, neither the item values gets filled in autoCompleteTextView nor the OnItemClickListener get fired.</p>
  
  <p>The code filters the suggestions with the text entered in autoCompleteTextView, but nothing happends onClick Event.</p>
  
  <p>Below is my code</p>
  
  <p>TeamSuggestionAdapter.java file</p>
  
  <pre><code>package com.material.ipladmin;
  
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.Filter;
  import android.widget.Filterable;
  import android.widget.LinearLayout;
  import android.widget.TextView;
  
  import com.bumptech.glide.Glide;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import de.hdodenhof.circleimageview.CircleImageView;
  
  
  
  
  public class TeamsSuggestionAdapter extends ArrayAdapter&lt;Team&gt; implements Filterable {
  
      private Context context;
  
      private List&lt;Team&gt; allTeams;
  
      private List&lt;Team&gt; teams;
  
      private ListFilter listFilter = new ListFilter();
  
  
      public TeamsSuggestionAdapter(Context context, List&lt;Team&gt; teams) {
          super(context, 0, teams);
          this.context = context;
          this.allTeams = teams;
  
      }
  
      @Override
      public int getCount() {
          return allTeams.size();
      }
  
      @Override
      public Team getItem(int i) {
          return allTeams.get(i);
      }
  
      @Override
      public long getItemId(int i) {
          return 0;
      }
  
      @Override
      public View getView(int i, View view, ViewGroup viewGroup) {
  
          if(view == null) {
              view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.add_match_suggestions_layout, viewGroup, false);
          }
  
          CircleImageView logo = view.findViewById(R.id.suggestionItemlogoImage);
          TextView name = view.findViewById(R.id.suggestionItemName);
          LinearLayout linearLayout = view.findViewById(R.id.addMatchSuggestionsLinearLayout);
  
          Team team = getItem(i);
  
          Glide.with(context).load(team.logo).into(logo);
          name.setText(team.teamName);
          linearLayout.setTag(team.teamId);
  
          return view;
      }
  
      @Override
      public Filter getFilter() {
          return listFilter;
      }
  
  
      class ListFilter extends Filter {
  
          private Object lock = new Object();
  
  
          @Override
          protected FilterResults performFiltering(CharSequence prefix) {
  
              FilterResults results = new FilterResults();
  
              if(teams == null) {
                  synchronized (lock) {
                      teams = new ArrayList&lt;&gt;(allTeams);
                  }
              }
  
              if (prefix == null || prefix.length() &lt;= 0) {
  
                  synchronized (lock) {
                      results.values = teams;
                      results.count = teams.size();
                  }
  
              }
              else
              {
  
                  String searchThis = prefix.toString().toLowerCase();
  
                  List&lt;Team&gt; searched = new ArrayList&lt;&gt;();
  
                  for (int i=0; i&lt;teams.size(); i++) {
  
                      if (teams.get(i).teamName.toLowerCase().contains(searchThis)) {
                          searched.add(teams.get(i));
                      }
  
                  }
  
                  results.values = searched;
                  results.count = searched.size();
  
              }
  
              return results;
          }
  
          @Override
          protected void publishResults(CharSequence charSequence, FilterResults results) {
  
              if (results.values != null) {
  
                  allTeams = (ArrayList&lt;Team&gt;) results.values;
  
              } else {
  
                  allTeams = null;
  
              }
  
              if (results.count &gt; 0 ) {
                  notifyDataSetChanged();
              }
              else {
                  notifyDataSetInvalidated();
              }
          }
  
          @Override
          public CharSequence convertResultToString(Object resultValue) {
              return ((Team) resultValue).teamId;
          }
      }
  
  }
  </code></pre>
  
  <p>add_match_suggestions_layout.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="horizontal"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:padding="5dp"
      android:clickable="true"
      android:focusable="true"
      android:id="@+id/addMatchSuggestionsLinearLayout"&gt;
  
      &lt;de.hdodenhof.circleimageview.CircleImageView
          android:layout_width="40dp"
          android:layout_height="40dp"
          android:id="@+id/suggestionItemlogoImage"
          android:src="@drawable/default_team_logo"
          android:layout_gravity="center"/&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:padding="10dp"
          android:id="@+id/suggestionItemName"
          android:textColor="@color/colorBlack"
          android:textSize="10sp"
          android:text="Suggestion Item name"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>MainActivity.java</p>
  
  <pre><code>TeamsSuggestionAdapter TeamsAdapter = new TeamsSuggestionAdapter(this, teams);
  
          autoCompleteTextView.setAdapter(TeamsAdapter);
  
          autoCompleteTextView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {
  
                  Toast.makeText(AddMatchActivity.this, "Item Clicked", Toast.LENGTH_SHORT).show();
  
              }
          });
  </code></pre>