I want to create a textedit field where the user enters a date only (no time). The date will get stored in MY SQL
. Whats the best way to do this with the least amount of validation? Is there like a built in textfield for dates that keeps it in the proper format?
I have this:
public static void AddEditTextDate(Context context, LinearLayout linearlayout, String text, int id) {
EditText edittext = new EditText(context);
edittext.setInputType(InputType.TYPE_DATETIME_VARIATION_DATE);
edittext.setText(text);
edittext.setId(id);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
edittext.setLayoutParams(params);
linearlayout.addView(edittext);
}
But when I try to type in it, it looks like a normal keyboard. I would expect it to go into the number pad by default or something...
EDIT: It needs to work with android 2.1+ (i.e. v7)
Does anyone know?
Thanks