title: Issue in searchable spinner adapter android
body: <p>I'm integrating searchable spinner in my app. Below is my code</p>
  
  <p><strong>gradle file</strong></p>
  
  <pre><code>    compile 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
  </code></pre>
  
  <p><strong>Xml file</strong></p>
  
  <pre><code> &lt;com.toptoche.searchablespinnerlibrary.SearchableSpinner
      android:id="@+id/spinner"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:hintText="Select Country"/&gt;
  </code></pre>
  
  <p><strong>Man.java</strong></p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  SearchableSpinner mSearchableSpinner;
  ArrayList&lt;GetCountry&gt; mGetCountries;
  PriorityAdapter mPriorityAdapter;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      mSearchableSpinner = (SearchableSpinner) findViewById(R.id.spinner);
  
      mGetCountries = new ArrayList&lt;&gt;();
      GetCountry mGetCountry = new GetCountry();
      mGetCountry.setId("1");
      mGetCountry.setName("India");
      mGetCountries.add(mGetCountry);
  
      GetCountry mGetCountry2 = new GetCountry();
      mGetCountry2.setId("2");
      mGetCountry2.setName("USA");
      mGetCountries.add(mGetCountry2);
  
  
      GetCountry mGetCountry3 = new GetCountry();
      mGetCountry3.setId("3");
      mGetCountry3.setName("UK");
      mGetCountries.add(mGetCountry3);
  
      GetCountry mGetCountry4 = new GetCountry();
      mGetCountry4.setId("4");
      mGetCountry4.setName("CHINE");
      mGetCountries.add(mGetCountry4);
  
      GetCountry mGetCountry5 = new GetCountry();
      mGetCountry5.setId("5");
      mGetCountry5.setName("MALASIYA");
      mGetCountries.add(mGetCountry5);
  
      mPriorityAdapter=new PriorityAdapter(mGetCountries);
      mSearchableSpinner.setAdapter(mPriorityAdapter);
  }
  
  
  public class PriorityAdapter extends ArrayAdapter&lt;GetCountry&gt; {
  
      ArrayList&lt;GetCountry&gt; list;
  
      public PriorityAdapter(ArrayList&lt;GetCountry&gt; list) {
          super(MainActivity.this, R.layout.spin_layout, list);
          this.list = list;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) { // Ordinary
  
  
          return initView(position, convertView, parent);
      }
  
      @Override
      public View getDropDownView(int position, View convertView,
                                  ViewGroup parent) { // This view starts when we click the
          // spinner.
          return initView(position, convertView, parent);
      }
  
      public View initView(int position, View convertView, ViewGroup parent) {
  
          LayoutInflater inflator = getLayoutInflater();
          convertView = inflator.inflate(R.layout.spin_layout, null);
          TextView mTextView = (TextView) convertView
                  .findViewById(android.R.id.text1);
          mTextView.setText(list.get(position).getName());
          return convertView;
      }
  
  }
  
  }
  </code></pre>
  
  <p>When i run above code i m getting output like below image. Custom arraylist data not display it is print garbage value of java every item
  <a href="https://i.stack.imgur.com/QN0UO.png" rel="nofollow noreferrer">Spinner Output</a></p>
  
  <p>Any idea how can i solve this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>    public class PriorityAdapter extends ArrayAdapter&lt;GetCountry&gt; {
  
      ArrayList&lt;GetCountry&gt; list;
  
      public PriorityAdapter(ArrayList&lt;GetCountry&gt; list) {
          super(MainActivity.this, R.layout.spin_layout, list);
          this.list = list;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) { // Ordinary
  
  
          return initView(position, convertView, parent);
      }
  
      @Nullable
      @Override
      public GetCountry getItem(int position) {
          return super.getItem(position);
      }
  
  
  
      @Override
      public View getDropDownView(int position, View convertView,
                                  ViewGroup parent) { // This view starts when we click the
  
          View view = convertView;
          LayoutInflater layoutInflater = LayoutInflater.from(getContext());
          view = layoutInflater.inflate(R.layout.spin_layout_1, parent, false);
  
          TextView tv= (TextView) view.findViewById(R.id.text1);
          tv.setText(list.get(position).getName());
          return view;
  
      }
  
      public View initView(int position, View convertView, ViewGroup parent) {
  
  
          View view = convertView;
          LayoutInflater layoutInflater = LayoutInflater.from(getContext());
          view = layoutInflater.inflate(R.layout.spin_layout_1, parent, false);
  
          TextView tv= (TextView) view.findViewById(R.id.text1);
          tv.setText(list.get(position).getName());
          return view;
      }
  
  }
  </code></pre>
  
  <p><strong>GetCountry.java</strong> </p>
  
  <pre><code>public class GetCountry {
  String name;
  String id;
  
  public String getName() {
      return name;
  }
  
  public void setName(String name) {
      this.name = name;
  }
  
  public String getId() {
      return id;
  }
  
  public void setId(String id) {
      this.id = id;
  }
  }
  </code></pre>