title: To set text on spinner
body: <p>I want to implement one code for three spinner where the user will fill there date of birth at register time when he/she will login and want to update there DOB, the DOB will pass on the spinner I have done it with day and month but there is one problem in year i.e adapter. adapter takes the (thisYear-18) year and print it but I want spinYear will take that value which I stored at registered time.   </p>
  
  <pre><code>@Override
      public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.edit_details_fragment);
      Spinner spinDay = (Spinner) findViewById(R.id.spinnerDay);
      Spinner spinMonth = (Spinner) findViewById(R.id.spinnerMonth);
      Spinner spinYear = (Spinner) findViewById(R.id.spinnerYear);
      Button update = (Button)findViewById(R.id.update);
  
      Intent intent =getIntent();
       String str_DOB = intent.getStringExtra("dateofbirth");
      Log.e("DOB************",str_DOB);
      String[] d = str_DOB.split("-");
      Log.e("d[0]-------",d[0].toString());
      spinYear.setSelection (Integer.parseInt(d[0]));
      spinMonth.setSelection (Integer.parseInt(d[1]));
      spinDay.setSelection (Integer.parseInt(d[2]));
  </code></pre>
  
  <p>code for Year Adapter</p>
  
  <pre><code>    ArrayList&lt;String&gt; years = new ArrayList&lt;String&gt;();
      int thisYear = Calendar.getInstance().get(Calendar.YEAR);
      thisYear=thisYear-18;
      for (int i = thisYear; i &gt;= 1967; i--) {
          years.add(Integer.toString(i));
      }
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_dropdown_item_1line, years);
      spinYear.setAdapter(adapter);
      spinYear.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView&lt;?&gt; adapterView, View view, int pos, long l) {
              final String yearName =  adapterView.getItemAtPosition(pos).toString().trim();
          }
          @Override
          public void onNothingSelected(AdapterView&lt;?&gt; adapterView) {
          }
      });  
  </code></pre>