I am showing the user interface using advanced linear layout, not activity programmatically. For instance,
Public class DisplayDatePicker extends LinearLayout {
So I want to display the date selection by clicking the getDate button; as well as display on a text image. }
Date = Calendar.getInstance();
btnnTest.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
showDateDialog(etTest, Date);
}
});
now extends over funtion showDateDialog, it successfully makes a call, but does not display the datepicker dialog box;
protected void showDateDialog(EditText etLocationTest2, Calendar date2) {
Log.i("", "Date showDateDialog ");
((Activity) getContext()).showDialog(DATE_DIALOG_ID);
}
In here Could not display Date picker Dialog box, why? i think showDialog box could not call DATE_DIALOG_ID,
so how to call this, any idea?
Deatils of showDialog box here:
protected Dialog onCreateDialog(int id) {
switch (id) {
case DATE_DIALOG_ID:
return new DatePickerDialog(getContext(), datePickerListener, year, month,day);
return null;
}
private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int selectedYear,
int selectedMonth, int selectedDay) {
year = selectedYear;
month = selectedMonth;
day = selectedDay;
tvDisplayDate.setText(new StringBuilder().append(month + 1)
.append("-").append(day).append("-").append(year)
.append(" "));
}
I hope you understand my problem and expect an answer.