Mark,

I'm not sure it would work, but have you tried to just
setFocusableInTouchMode(true) on the WebView object? Seems a lot
easier than messing with the touch handler.

Michael

On Feb 7, 3:45 pm, Mark Nuetzmann <mark.nuetzm...@gmail.com> wrote:
> Sergey,
> I ended up doing basically what you posted but only for the
> ACTION_DOWN as that seemed to handle it.
>
> Fred,
> I tried adding an OnClickListener but never got any callbacks.  I
> assume that the WebView is designed to handle this internally and
> expects you to use the WebViewClient.shouldOverrideUrlLoading() to
> respond to the clicks.  As to whether it happens in the emulator I am
> not sure.  I learned a long time ago with WM not to trust emulators so
> I only debug on-device...
>
> Thanks for the comments guys!
> Mark
>
> On Feb 7, 11:28 am, Sergey Ten <sergeyte...@gmail.com> wrote:
>
> > Mark,
>
> > I think I had this problem myself and could solve it by using the following
> > code:
>
> >        webView.setOnTouchListener(new View.OnTouchListener() {
> >            public boolean onTouch(View v, MotionEvent event) {
> >                switch (event.getAction()) {
> >                    case MotionEvent.ACTION_DOWN:
> >                    case MotionEvent.ACTION_UP:
> >                        if (!v.hasFocus()) {
> >                            v.requestFocus();
> >                        }
> >                        break;
> >                }
> >                return false;
> >            }
> >        });
>
> > Hope this would help,
> > Sergey
>
> > On Sat, Feb 7, 2009 at 12:07 AM, Mariano Kamp <mariano.k...@gmail.com>wrote:
>
> > > Mark, maybe you should post some code?
>
> > > On Thu, Feb 5, 2009 at 4:36 PM, Mark Nuetzmann 
> > > <mark.nuetzm...@gmail.com>wrote:
>
> > >> I have an Activity that has a WebView that contains some simple html
> > >> that allows me to display a Terms & Conditions link that if touched or
> > >> clicked calls another activity.  My problem is unless the link in the
> > >> WebView has focus (ie, the text is wrapped with that little orange
> > >> focus) I cannot touch the link and have it work.  If any other view on
> > >> the activity has focus, touching the WebView with the link does
> > >> nothing.  The other Views that had focus loose focus, but the WebView
> > >> does not receive focus.  I have tried calling setFocusable(true) and
> > >> setFocusableInTouchMode(true) but that does not do any good...
>
> > >> I would really like to know what you have to do to get a WebView to
> > >> respond to touch events without using the trackball to scroll to the
> > >> view before touching it.
>
> > >> thank you,
> > >> Mark
--~--~---------~--~----~------------~-------~--~----~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to