title: how to hide selected item from spinner list in android
body: <p>i want to hide selected item from the list of spinner just this questions <a href="https://stackoverflow.com/q/26307553/7784663">Hide the selected item from the custom spinner list</a> but i didn't get the answer. i just want to do exactly like the question in link my code is....</p>
  
  <pre><code>toolbar.xml
  
      &lt;android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          xmlns:tools="http://schemas.android.com/tools"
          android:id="@+id/toolbar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="?attr/colorPrimaryDark"
          android:minHeight="?attr/actionBarSize"
          app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
           &gt;
  
          &lt;Spinner
              android:id="@+id/spinner_nav"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" /&gt;
  
      &lt;/android.support.v7.widget.Toolbar&gt;
  
  toolbarActivity
  
      &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="#c9c9c9"
          android:orientation="vertical" &gt;
  
          &lt;include
              android:id="@+id/toolbar"
              layout="@layout/spintoolbar" /&gt;
  
  
      &lt;/LinearLayout&gt;
  
  spinnerAdapter
  
      public class CustomSpinnerAdapter extends ArrayAdapter&lt;String&gt; {
  
       private Context context1;
       private ArrayList&lt;String&gt; data;
       public Resources res;
       LayoutInflater inflater;
  
       public CustomSpinnerAdapter(Context context, ArrayList&lt;String&gt; objects) {
        super(context, R.layout.spinner_row, objects);
  
        context1 = context;
        data = objects;
  
        inflater = (LayoutInflater) context1
          .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
       }
  
       @Override
       public View getDropDownView(int position, View convertView, ViewGroup parent) {
        return getCustomView(position, convertView, parent);
       }
  
       @Override
       public View getView(int position, View convertView, ViewGroup parent) {
        return getCustomView(position, convertView, parent);
       }
  
       // This funtion called for each row ( Called data.size() times )
       public View getCustomView(int position, View convertView, ViewGroup parent) {
  
        View row = inflater.inflate(R.layout.spinner_row, parent, false);
  
        TextView tvCategory = (TextView) row.findViewById(R.id.tvCategory);
  
        tvCategory.setText(data.get(position).toString());
  
        return row;
       }
      }
  
  
  
  spinner_row.xml
  
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_margin="5dp"
     android:background="@drawable/spinner_selector"
      android:orientation="vertical" &gt;
  
      &lt;TextView
          android:id="@+id/tvCategory"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_margin="10dp"
          android:textSize="18sp"
          /&gt;
  
  &lt;/RelativeLayout&gt;
  
  
  spinnerAcivity
  
  
  
        public class SpinToolbarActivity extends AppCompatActivity {
  
           private Toolbar toolbar;
  
           private Spinner spinner_nav;
  
           @Override
           protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.spintoolbaractivity);
            toolbar = (Toolbar) findViewById(R.id.toolbar);
            spinner_nav = (Spinner) findViewById(R.id.spinner_nav);
  
            if (toolbar != null) {
             setSupportActionBar(toolbar);
             getSupportActionBar().setDisplayShowTitleEnabled(false);
  
            }
            addItemsToSpinner();
  
           }
  
           // add items into spinner dynamically
           public void addItemsToSpinner() {
  
            ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
            list.add("Top News");
            list.add("Politics");
            list.add("Business");
            list.add("Sports");
            list.add("Movies");
  
            // Custom ArrayAdapter with spinner item layout to set popup background
  
            CustomSpinnerAdapter spinAdapter = new CustomSpinnerAdapter(
              getApplicationContext(), list);
            spinner_nav.setAdapter(spinAdapter);
  
            spinner_nav.setOnItemSelectedListener(new OnItemSelectedListener() {
  
             @Override
             public void onItemSelected(AdapterView&lt;?&gt; adapter, View v,
               int position, long id) {
              // On selecting a spinner item
              String item = adapter.getItemAtPosition(position).toString();
  
              // Showing selected spinner item
              Toast.makeText(getApplicationContext(), "Selected  : " + item,
                Toast.LENGTH_LONG).show();
             }
  
             @Override
             public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
              // TODO Auto-generated method stub
  
             }
            });
  
           }
  
           @Override
           public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.main, menu);
            return true;
           }
          }
  </code></pre>