Android Spinner
<p>I am working in Spinner.. I am having three spinners and i am going  to display days (i,e) 1,2,3,4,5...30,31 in 1st spinner and months in 2nd spinner (i,e)1,2,3,...11,12 and Year in 3rd spinner 2010,....  What i want is that that i wanna to display current date,month,year in 1st,2nd,3rd spinner resp when the page loads..from that it is possible to select any day,month,Year
Here is my code::</p>

<pre><code>public class NoteEdit extends Activity implements OnItemSelectedListener {

private EditText mTitleText;
private EditText mBodyText;
private Long mRowId;
private NotesDbAdapter mDbHelper;
private String array_spinner[];
private int currentDayOfMonth=0;
private int currentDayOfDays=0;
private final String[] months = {"1","2","3","4","5","6","7","8","9","10","11","12"};
Spinner s1,s,s2;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mDbHelper = new NotesDbAdapter(this);
    mDbHelper.open();
    setContentView(R.layout.note_edit);

     Calendar cal = Calendar.getInstance();
     cal.set(Calendar.MONTH,month);//month starts from 0
     cal.set(Calendar.YEAR,year);
     int noOfDayInMonthyear = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
     Log.v("noOfDayInMonthyear",""+noOfDayInMonthyear);

    ArrayList&lt;Integer&gt; obj=new ArrayList();
    ArrayList&lt;Integer&gt; obj1=new ArrayList();
      for(int i=1;i&lt;=noOfDayInMonthyear;i++){
          obj.add(i); 
      }
      Log.v("Size",""+obj.size());
      for(int i=2010;i&lt;=2020;i++){
          obj1.add(i); 
      }
      Log.v("Size1",""+obj1.size());
         s = (Spinner) findViewById(R.id.Spinner01);
        ArrayAdapter adapter = new ArrayAdapter(this,android.R.layout.simple_spinner_item,obj);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        s.setAdapter(adapter);
        s.setOnItemSelectedListener(NoteEdit.this);

         s1 = (Spinner) findViewById(R.id.Spinner02);
        ArrayAdapter adapter1 = new ArrayAdapter(this,android.R.layout.simple_spinner_item,months);
        adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        s1.setAdapter(adapter1);
        s1.setOnItemSelectedListener(NoteEdit.this);

     s2 = (Spinner) findViewById(R.id.Spinner03);
    ArrayAdapter adapter2 = new ArrayAdapter(this,android.R.layout.simple_spinner_item,obj1);
    adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    s2.setAdapter(adapter2);
    s2.setOnItemSelectedListener(NoteEdit.this);
    s2.setAdapter(adapter2);



    mTitleText = (EditText) findViewById(R.id.title);
    mBodyText = (EditText) findViewById(R.id.body);

    Button confirmButton = (Button) findViewById(R.id.confirm);

    mRowId = savedInstanceState != null ? savedInstanceState.getLong(NotesDbAdapter.KEY_ROWID) 
                                        : null;
    if (mRowId == null) {
        Bundle extras = getIntent().getExtras();            
        mRowId = extras != null ? extras.getLong(NotesDbAdapter.KEY_ROWID) 
                                : null;
    }

    populateFields();

    confirmButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View view) {
            setResult(RESULT_OK);
            finish();
        }

    });
}


public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int arg2,
        long arg3) {

}


public void onNothingSelected(AdapterView&lt;?&gt; arg0) {


}
</code></pre>
