i am developing an android applicATION... in which there is a datepicker for date of birth to be selected... But when the date is displayed... for example date is january 0 is displayed instead of 1 and for february 1 is displayed instead of 2.. and I need to value of date in 3 textviews... for example if date is 04/02/1984 ... i need to take 04 to one textview and 2 to another and 1984 to another one.... pls help..
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final DatePicker date = (DatePicker) findViewById(R.id.datePicker1);
final TextView tvDate = (TextView) findViewById(R.id.textView2);
date.init(date.getYear(), date.getMonth(), date.getDayOfMonth(),new OnDateChangedListener()
{
@Override
public void onDateChanged(DatePicker arg0,int arg1, int arg2, int arg3) {
// TODO Auto-generated method stub
String date=Integer.toString(arg1);
String month=Integer.toString(arg2);
String year=Integer.toString(arg3);
tvDate.setText(date + month + year);
}
}
);
}
}