Ok instead I'm setting an OnKeyListener:

 // OnKeyListener
 if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode ==
KeyEvent.KEYCODE_DPAD_CENTER) {
     // user 'clicked' in the EditText.
 }

This combined with the OnTouchListener seems to cover all my needs,

Thanks

On Dec 3, 10:10 am, Mark Wyszomierski <[email protected]> wrote:
> Hi Steve,
>
> What is the cursor-is-placed-into-the-edit-text event though? Is that
> just when the EditText gets any kind of focus? (for example, when I
> scroll over to an edit text, it gets the orange rect and the cursor
> starts blinking inside of it).
>
> Ideally i want to know when the user simply clicks or touches the edit
> text - seems like there should be an easy way to do it!
>
> Thanks
>
> On Dec 3, 10:02 am, Steve Oliver <[email protected]> wrote:
>
> > so do you mean, like when the cursor is placed into the edit text?  you can
> > do that, I do that to hide views to make room for the IME.
>
> > On Thu, Dec 3, 2009 at 6:54 AM, Mark Wyszomierski <[email protected]> wrote:
> > > >> 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 <[email protected]> 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 <[email protected]>
> > > 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 <[email protected]> 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 <[email protected]>
> > > > > 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 <[email protected]> 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 <[email protected]> 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 <[email protected]>
> > > 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
> > > > > [email protected]
> > > > > > > To unsubscribe from this group, send email to
> > > > > > > [email protected]<android-developers%[email protected]><android-developers%2Bunsubs
> > > [email protected]>
> > > > > <android-developers%[email protected]<android-developers%[email protected]><android-developers%252Bu
> > > [email protected]>
>
> > > > > > > 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
> > > [email protected]
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]<android-developers%[email protected]><android-developers%2Bunsubs
> > > [email protected]>
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/android-developers?hl=en
>
> > > > --
> > > > Dianne Hackborn
> > > > Android framework engineer
> > > > [email protected]
>
> > > > 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 [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]<android-developers%[email protected]>
> > > 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to