title: Create Custom BaseAdapter in Android 2.3.3
body: <p>I want To Create my custom baseadapter So I try the following :</p>
  
  <p>MainActivity.java</p>
  
  <pre><code>import android.os.Bundle;
  import android.widget.ArrayAdapter;
  import android.widget.AdapterView.OnItemSelectedListener;
  import android.widget.Spinner;
  import android.app.Activity;
  import android.view.Menu;
  import android.view.View;
  import org.ksoap2.serialization.SoapObject;
  import org.ksoap2.serialization.SoapSerializationEnvelope;
  import org.ksoap2.transport.HttpTransportSE;
  import java.util.ArrayList;
  
  public class SignupActivity extends Activity {
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_signup);
          String [] arr = {"USA","Canda","Germany","Italy"};
          Spinner S1 = (Spinner) findViewById(R.id.Spinner_Signup);
          CustomCountryAdpater adapter = new CustomCountryAdpater(this, arr);
          S1.setAdapter(adapter);
      }
  }
  </code></pre>
  
  <p>CustomCountryAdpater.java</p>
  
  <pre><code>import android.view.View;
  import android.view.LayoutInflater;
  import android.view.ViewGroup;
  import android.widget.BaseAdapter;
  import android.content.Context;
  import java.util.ArrayList;
  import android.widget.TextView;
  
  public class CustomCountryAdpater extends BaseAdapter {
      public Context con;
      //public ArrayList&lt;Country&gt; tempList;
      String [] arr;
      public LayoutInflater myInflater;
      public CustomCountryAdpater (Context C,String [] arr)
      {
          this.con = C;
          this.arr = arr;
          this.myInflater = (LayoutInflater) C.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
      }
      @Override
      public int getCount() {
          // TODO Auto-generated method stub
          return this.arr.length;
      }
  
      @Override
      public Object getItem(int arg0) {
          // TODO Auto-generated method stub
          return this.arr[arg0];
      }
  
      @Override
      public long getItemId(int arg0) {
          // TODO Auto-generated method stub
          return arg0;
      }
  
      @Override
      public View getView(int arg0, View arg1, ViewGroup arg2) {
          // TODO Auto-generated method stub
          if (arg1==null)
          {
              arg1 = myInflater.inflate(android.R.layout.simple_list_item_1, arg2, false);
              TextView TT = (TextView) arg1.findViewById(android.R.id.text1);
              TT.setText(this.arr[arg0]);
          }       
          return arg1;
      }
  
  }
  </code></pre>
  
  <p>when I click on the spinner for first time I got the correct list :</p>
  
  <p><img src="https://i.stack.imgur.com/ECEQt.jpg" alt="enter image description here"></p>
  
  <p>but if I choose Germany, For example and click on the spinner again I get the following list that have no Germany !!!</p>
  
  <p><img src="https://i.stack.imgur.com/l5HLW.jpg" alt="enter image description here"></p>
  
  <p>can anyone told me Why ?!!!</p>