[android-developers] Re: Soft keypad doesn't appear if EditText.setOnClickListener() is set?
>> as a general rule you should not be doing anything from a click on an EditText''
ok, is there a way to be notified that the user intends to start
entering input into an EditText then? I want to display a little image
when the user either:
A) clicks on the EditText
B) touches the EditText.
I don't want to display the image when the EditText simply gets focus,
because that occurs when the user scrolls over the EditText with the
trackball (for my users, different then explicitly tapping the field
or scrolling to it, then hitting DPAD_CENTER).
There must be some way to know when an EditText is ready for editing
by the user, without breaking other aspects of the system?
Thanks
On Dec 3, 12:07 am, Dianne Hackborn <hack...@android.com> wrote:
> isActive() asks about whether a local view is an active target, nothing
> about whether the IME is displayed:
>
> http://developer.android.com/reference/android/view/inputmethod/Input...()
>
> I can't say off-hand why setting a click listener would prevent the IME from
> being shown, but as a general rule you should not be doing anything from a
> click on an EditText, since this is dedicated to displaying the IME.
>
>
>
>
>
> On Wed, Dec 2, 2009 at 7:13 PM, Mark Wyszomierski <mar...@gmail.com> wrote:
> > Ah phew ok at least I'm not the only one seeing that behavior! In my
> > UI, when the user clicks on the EditText, I want to expand some other
> > UI elements - something like a list pops up with suggested keywords -
> > it works, but it has the side effect of blocking the IME keypad from
> > coming up.
>
> > However, if I try running a test to see if a keypad is active for the
> > EditText that was clicked, like:
>
> > InputMethodManager imm = (InputMethodManager)getContext
> > ().getSystemService(Context.INPUT_METHOD_SERVICE);
> > if (imm.isActive()) {
> > Log.d(TAG, "yes the keypad is active.");
> > }
>
> > it reports true. So maybe it does somehow display but gets hidden or
> > something? I don't know.
>
> > Thanks
>
> > On Dec 2, 9:43 pm, Steve Oliver <steveoliv...@gmail.com> wrote:
> > > ahhh, ok, so maybe I was not totally understanding you, and now I see my
> > > text field does the same thing -- if you touch it, you get the IME, but
> > if
> > > you click it with the trackball press, no keyboard. Although I'm not
> > sure
> > > why a user would need to do that?
>
> > > On Wed, Dec 2, 2009 at 6:35 PM, Mark Wyszomierski <mar...@gmail.com>
> > wrote:
> > > > Hi Steve,
>
> > > > Thanks for taking a look - maybe I haven't set a parameter on my edit
> > > > text then? I'm doing:
>
> > > > EditText et = new EditText(context);
> > > > et.setInputType(InputType.TYPE_CLASS_TEXT);
> > > > et.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
> > > > et.setOnTouchListener(...); // touch listener works perfectly.
> > > > et.setOnClickListener(new OnClickListener() {
> > > > public void onClick(View arg0) {
> > > > Log.d(TAG, "We were clicked!");
> > > > }
> > > > });
>
> > > > so click always prints the message, it's just that the IME keyboard
> > > > doesn't come up for me when the handler is added. Take away the call
> > > > to setOnClickListener(), and the keyboard appears again. I'll try
> > > > writing another test for it,
>
> > > > Thanks
>
> > > > On Dec 2, 9:30 pm, Steve <steveoliv...@gmail.com> wrote:
> > > > > I just dug into an edit text I was working on a while back, and I see
> > > > > I used setOnKeyListener and setOnTouchListener in addition to
> > > > > setOnClickListener. Not 100% that I remember why I had to do that :)
> > > > > but in any case the soft keyboard will open when you click or touch
> > > > > the edit text, and also you can track all of its keystrokes. And I
> > > > > can track when the edit text is clicked.
>
> > > > > On Dec 2, 11:46 am, Mark Wyszomierski <mar...@gmail.com> wrote:
>
> > > > > > Still stuck on this, if anyone has a suggested work around - I
> > > > > > basically just want to know when an EditText is clicked, but also
> > make
> > > > > > sure the IME keypad is displayed when clicked (the OnClickListener
> > > > > > seems to block that default behavior).
>
> > > > > > I tried to check if the keypad is visible/active with the
> > following,
> > > > > > but it always reports true, however I can't see it on screen:
>
> > > > > > InputMethodManager imm = (InputMethodManager)getContext
> > > > > > ().getSystemService(Context.INPUT_METHOD_SERVICE);
> > > > > > if (imm.isActive() == false) {
> > > > > > Log.d(TAG, "key pad is not active.");
> > > > > > }
>
> > > > > > is there another way to check if the keypad is really visible?
>
> > > > > > Thanks
>
> > > > > > On Nov 30, 1:35 am, Mark Wyszomierski <mar...@gmail.com> wrote:
>
> > > > > > > Hi,
>
> > > > > > > I have an EditText. If I set an OnClickListener for it,
> > theimekeypad
> > > > > > > doesn't appear when I click it (using the trackball on the G1):
>
> > > > > > > EditText edit = new EditText(context);
> > > > > > > edit.setOnClickListener(new OnClickListener() {
> > > > > > > public void onClick(View v) {
> > > > > > > //imekeypad won't appear when this is set and clicked.
> > > > > > > }
> > > > > > > });
>
> > > > > > > if I don't set the click listener, the keypad will appear when
> > > > > > > clicked. Is this expected behavior, or am I doing something
> > wrong?
>
> > > > > > > Thanks
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to
> > android-developers@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > android-developers+unsubscribe@googlegroups.com<android-developers%2Bunsubs cribe@googlegroups.com>
> > <android-developers%2Bunsubscribe@googlegroups.com<android-developers%252Bu nsubscribe@googlegroups.com>
>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > > --
> > > Android mobile application developmenthttp://steveoliverc.wordpress.com/
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscribe@googlegroups.com<android-developers%2Bunsubs cribe@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails. All such
> questions should be posted on public forums, where I and others can see and
> answer them.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home