Popping a dialog when an EditText gets focus seems like a non-standard interface. Consider that the normal function of EditText is completely circumvented since you wouldn't even be able to make changes to a date that you chose because each time you give it focus you are popping this dialog Since you are using it as a TextView, why not just use an actual TextView coupled with a button? When the button is clicked, bring up the DatePicker and call TextView.setText() with the date formatted the way you want it.
You can use the onClickListener for the button and it will behave as you expect. I believe this will make the function clearer to users.
1 I disagree - it seems to be pretty standard. In fact, Google's default Android contacts app does exactly what the OP describes (look at the birthday field in the edit contact view). – Russell Davis Aug 16 at 18:46.
Here is the solution I implemented mPickDate. SetOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { showDialog(DATE_DIALOG_ID); return false; } }); OR mPickDate. SetOnFocusChangeListener(new View.
OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { showDialog(DATE_DIALOG_ID); } }); See the differences by yourself. Problem is since (like RickNotFred said) TextView to display the date & edit via the DatePicker. TextEdit is not used for its primary purpose.
If you want the DatePicker to re-pop up, you need to input delete (1st case) or de focus (2nd case). Ray.
Unless you add a onClickListener which I just did together with a onFocusChangeListener. This will work :-) – NeTeInStEiN Apr 12 at 18:04.
The keyboard seems to pop up when the EditText gains focus. To prevent this, set focusable to false: This behavior can vary on different manufacturers' Android OS flavors, but on the devices I've tested I have found this to to be sufficient. If the keyboard still pops up, using hints instead of text seems to help as well: myEditText.
SetText("My text"); // instead of this... myEditText. Set // try this Once you've done this, your on click listener should work as desired: myEditText. SetOnClickListener(new OnClickListener() {...}).
IMHO I disagree with RickNotFred's statement: Popping a dialog when an EditText gets focus seems like a non-standard interface. Displaying a dialog to edit the date when the use presses the an EditText is very similar to the default, which is to display a keyboard or a numeric key pad. The fact that the date is displayed with the EditText signals to the user that the date may be changed.
Displaying the date as a non-editable TextView signals to the user that the date may not be changed.
As Dillon Kearns suggested, setting focusable to false works fine. But if your goal is to cancel the keyboard when EditText is clicked, you might want to use: mEditText. SetInputType(0).
Popping a dialog when an EditText gets focus seems like a non-standard interface. Consider that the normal function of EditText is completely circumvented since you wouldn't even be able to make changes to a date that you chose because each time you give it focus you are popping this dialog. Since you are using it as a TextView, why not just use an actual TextView coupled with a button?
When the button is clicked, bring up the DatePicker and call TextView.setText() with the date formatted the way you want it. You can use the onClickListener for the button and it will behave as you expect. I believe this will make the function clearer to users.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.