title: Android spinner change position of element after selection
body: <p>Hi I got a problem with a spinner, after selecting an item the position of elements in the list change, here's my code:
  private static class ServerListItemAdapter extends BaseAdapter {</p>
  
  <pre><code>    private ArrayList&lt;ServerData&gt; serverList;
  
      private LayoutInflater mInflater;
  
  
      public ServerListItemAdapter(Context context,ArrayList&lt;ServerData&gt; _serverList) {
           mInflater = LayoutInflater.from(context);
           serverList=_serverList;
       }
  
      @Override
      public int getCount() {
          return serverList.size();
      }
  
      @Override
      public Object getItem(int pos) {
          return serverList.get(pos);
      }
  
      @Override
      public long getItemId(int pos) {
          return serverList.get(pos).hashCode();
      }
  
      private void printServerList(){
          Log.d(TAG, "PRINT - start");
          int pos=0;
          for(ServerData server:serverList){
              Log.d(TAG, pos+":"+server.serverName);
              pos++;
          }
          Log.d(TAG, "PRINT - end");
      }
      @Override
       public View getView(int position, View convertView, ViewGroup parent) {
          Log.d(TAG, "getView -start- pos:"+position);
          printServerList();
           final ViewHolder holder;
           if (convertView == null) {
               convertView = mInflater.inflate(R.layout.select_server_list_item, null);
               holder = new ViewHolder();
  
               holder.server=serverList.get(position);
               Log.d(TAG,"Pos:"+position+", server:"+holder.server.serverName);
  
  
               holder.txtServerName=(TextView)convertView.findViewById(R.id.txt_server_name);
               Log.d(TAG, "Set text for position "+ position+ ": "+ holder.server.serverName);
               holder.txtServerName.setText(serverList.get(position).serverName);
  
               convertView.setTag(holder);
           } else {
               holder = (ViewHolder) convertView.getTag();
           }
           Log.d(TAG, "getView -end- pos:"+position);
           return convertView;
       }
  
       static class ViewHolder {
           TextView txtServerName;
  
           ServerData server;
       }
  
  
  
  }
  
  
  private class ServerData{
      public String serverName="";
      public String serverURL="";
  
      public ServerData(String _serverName,String _serverURL){
          serverName=_serverName;
          serverURL=_serverURL;
      }
  }
  </code></pre>
  
  <p>If I start with a list like { A,B,C} and I select A, the list became {A,B,A} but into the code, as you can see, there's no statement that ask android to do so.</p>
  
  <p>Thanks</p>