Datepickerdialog Select the date and call the ShowDialog (int id) method, the Oncreatedialog method is executed:
@Override
protected Dialog oncreatedialog (int id) {
Switch (ID) {
Case DATE_PICKER_ID:
return new Datepickerdialog (this,ondatesetlistener,2015,8,12);
}
return Super.oncreatedialog (ID);
}
Datepickerdialog.ondatesetlistener Ondatesetlistener = new Datepickerdialog.ondatesetlistener () {
@Override
public void Ondateset (DatePicker view, int year, int monthofyear,int dayofmonth) {
Toast.maketext (forme.this, Year + "-" + Monthofyear + "-" + DayOfMonth, Toast.length_short). Show ();
}
};
Autocompletetextview provides a drop-down list to choose from:
First, declare a Autocompletetextview control in the XML file
<autocompletetextview
Android:id= "@+id/autocomplete"
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
android:layout_marginleft= "5DP"/>
The Autocompletetextview object is then bound to the control by means of the Findviewbyid method:
Private Autocompletetextview Autocompletetextview = null;
Autocompletetextview = (Autocompletetextview) Findviewbyid (r.id.autocomplete);
list<string> list = new arraylist<string> ();
List.add ("ABCD");
List.add ("Ddffd");
arrayadapter<string> adapter = new Arrayadapter<string> (this,r.layout.list_item,list); Here the list can also be a string array
Autocompletetextview.setadapter (adapter);
Datepickerdialog, Autocompletetextview