title: Searchable Spinner not working in android
body: <p>I had a simple spinner which i working perfect. Now I wanted to change it that a user can able to search the items in it. By following the below code I have done changes.</p>
  
  <p><strong>Sample code</strong></p>
  
  <pre><code>//Gradle
  
   compile 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
  
  //activity_main.xml
  
   &lt;com.toptoche.searchablespinnerlibrary.SearchableSpinner
      android:id="@+id/searchable_spinner"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" /&gt;
  // In main activity 
  
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      SearchableSpinner searchableSpinner = (SearchableSpinner) findViewById(R.id.searchable_spinner);
      String[] names = new String[]{"India","CHINA","UK","US","MALYSIA"};
      ArrayAdapter arrayAdapter = new ArrayAdapter(MainActivity.this,android.R.layout.simple_spinner_dropdown_item,names);
      searchableSpinner.setAdapter(arrayAdapter);
  
      searchableSpinner.setTitle("Select Item");
      searchableSpinner.setPositiveButton("OK");
  
  }
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <p>On click of the <code>dropdown</code></p>
  
  <p><a href="https://i.stack.imgur.com/F3u63.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F3u63.png" alt="enter image description here"></a></p>
  
  <p><strong>What i have done?</strong></p>
  
  <pre><code>//added the library in gradle 
  compile 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
  
  //new_form_layout (i have created this)
  &lt;com.toptoche.searchablespinnerlibrary.SearchableSpinner
                  android:id="@+id/smart_msn_spinner"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:layout_gravity="right|center_vertical"
                  android:gravity="right" /&gt;
  
  **In My Fragment**
  @BindView(R.id.smart_msn_spinner)
  SearchableSpinner smartMsnSpinner;
  </code></pre>
  
  <p>Now I have created a <code>bindListners()</code> function in which I am binding all the values and I am calling it in my <code>onCreateView</code> function</p>
  
  <pre><code> public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      if (view == null) {
          view = inflater.inflate(R.layout.new_form_layout, container, false);
          ButterKnife.bind(this, view);
          bindListners(); // here i am calling it
          imsiNo.setVisibility(View.GONE);
          setupUI(mScrollView);
      }
      Bundle arguments = getArguments();
      if (arguments != null &amp;&amp; arguments.containsKey("install_id")) {
          isNewInstall = false;
          editInstallId = arguments.getString("install_id");
          getActivity().setTitle(getString(R.string.title_fragment_edit_form));
          setEditData();
          imsiNo.setVisibility(View.GONE);
          resetFormButton.setVisibility(View.GONE);
      } else {
          getActivity().setTitle(getString(R.string.title_fragment_new_form));
      }
  
      /*mCoordinatesReceiver = new CoordinatesReceiver();
      IntentFilter intentFilter = new IntentFilter();
      intentFilter.addAction(Common.GetCoordinatesAction());
      getActivity().registerReceiver(mCoordinatesReceiver, intentFilter);*/
      return view;
  }
  bindListeners(){
  .......
  
      //Searchable smartMsnSpinner spinner and adapter
      meterSrArrayList = new ArrayList&lt;String&gt;();
  
      meterSrNumAdapter = new ArrayAdapter&lt;String&gt;(getActivity(), R.layout.custom_spinner_layout, meterSrArrayList);
      smartMsnSpinner.setAdapter(meterSrNumAdapter);
      smartMsnSpinner.setTitle("Select Item");
      smartMsnSpinner.setPositiveButton("Ok");
      smartMsnSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) {
              selectedMeterNo = meterSrArrayList.get(position);
          }
  
          @Override
          public void onNothingSelected(AdapterView&lt;?&gt; parent) {
  
          }
  
      });
   }
  </code></pre>
  
  <p>On running my app i am just getting simple drop down list as before.</p>
  
  <p><a href="https://i.stack.imgur.com/XZuB8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XZuB8.png" alt="enter image description here"></a></p>
  
  <p>I don't know what is the problem and what I am missing as i have done everything that is in the sample. </p>
  
  <p>I have run the sample code in my device and it's working fine. I don't know why it's not working on my app</p>
  
  <p><strong>Update</strong></p>
  
  <p>After watching the <code>logcat</code>the error i am seeing is </p>
  
  <pre><code>Parcelable encountered IOException writing serializable object (name = com.toptoche.searchablespinnerlibrary.SearchableSpinner)
  </code></pre>
  
  <p>Any help would be highly appreciated.</p>