title: Spinner - How to put user's selection at top position
body: <p>I was wondering if someone could help me with my code. I have a spinner containing six items in an array with the third item set as the default. When the user selects an item, I want the user's selection to move to the top position in the spinner. To clarify, if I have items A, B, C, D, E, and F:</p>
  
  <p>Default:</p>
  
  <pre><code>C
  
  --
  
  A
  
  B
  
  D
  
  E
  
  F
  </code></pre>
  
  <p>If the user selects D:</p>
  
  <pre><code>D
  
  --
  
  A
  
  B
  
  C
  
  E
  
  F
  </code></pre>
  
  <p>As shown in the "diagram," I'm also trying to figure out how to put a divider only on the top selection.</p>
  
  <p>Here's the code I have so far. I've just started learning Android so I'm quite iffy on everything, but any help is appreciated, thank you!</p>
  
  <p>-- UPDATED CODE --</p>
  
  <pre><code>public class Test extends AppCompatActivity implements OnItemSelectedListener {
  
  List&lt;String&gt; list;
  String [] objects = {"A","B","C","D","E","F"};
  ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;&gt;(this,
          android.R.layout.simple_spinner_item, objects);
  
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_test);
  
      Spinner spinner = (Spinner) findViewById(R.id.spinner);
      spinner.setOnItemSelectedListener(this);
      list = new ArrayList&lt;&gt;(Arrays.asList(objects));
  
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  
      spinner.setAdapter(adapter);
      spinner.setSelection(2);
  
      adapter.notifyDataSetChanged();
  }
  public void onItemSelected(AdapterView&lt;?&gt; parent, View view,
                             int pos, long id) {
      list.remove(pos);
      objects=list.toArray(new String[0]);
      adapter.notifyDataSetChanged();
  }
  
  public void onNothingSelected(AdapterView&lt;?&gt; parent) {
  
  }
  </code></pre>