Strange.  According to the docs false means that the event has not
been handled: "true if the event is consumed, else false"

Changing it to true works though.  Thanks.


On Jan 20, 12:53 pm, Romain Guy <romain...@android.com> wrote:
> Because you return "false", which means you don't want to handle events.
>
>
>
> On Wed, Jan 20, 2010 at 12:49 PM, ClarkBattle <clarkbat...@gmail.com> wrote:
> > I have an activity defined as:
>
> > public class MyDemo extends Activity
> > {
> >       �...@override
> >        public void onCreate( Bundle savedInstanceState )
> >        {
> >                super.onCreate( savedInstanceState );
> >                setContentView( R.layout.main );
> >        }
>
> >       �...@override
> >        public boolean onTouchEvent(MotionEvent me)
> >        {
> >                Log.i("MyDemo motion", "" + me.getAction());
> >                return false;
> >        }
> > }
>
> > With this custom view in main.xml
>
> > <?xml version="1.0" encoding="utf-8"?>
> >  <com.test.MyCustomView
> >    xmlns:android="http://schemas.android.com/apk/res/android";
> >    android:layout_width="wrap_content"
> >    android:layout_height="wrap_content"  />
>
> > MyCustomView.java contains
>
> > public class MyCustomView
> >        extends FrameLayout
> >        implements OnGestureListener
> > {
> >        public MyTest( Context context, AttributeSet attrs )
> >        {
> >                super( context, attrs );
> >                LayoutInflater.from( context ).inflate( R.layout.doofer, 
> > this,
> > true );
> >        }
>
> >       �...@override
> >        public boolean onTouchEvent(MotionEvent me)
> >        {
> >                Log.i("MyCustomView motion", "" + me.getAction());
> >                return false;
> >        }
> > }
>
> > And finally doofer.xml is
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <FrameLayout xmlns:android="http://schemas.android.com/apk/res/
> > android"
> >    android:id="@+id/dooferFrame"
> >    android:layout_width="200dip"
> >    android:layout_height="200dip"
> >    android:background="#80ff0000" >
> >    <TextView
> >        android:id="@+id/doofer"
> >        android:layout_width="fill_parent"
> >        android:layout_height="fill_parent" />
> > </FrameLayout>
>
> > So... looking at LogCat we can see the motion events that occur.  The
> > MyDemo Activity logs down, up and move events perfectly as expected.
> > However, MyCustomView only logs down events!
>
> > Why aren't ACTION_UP and ACTION_DOWN Touch Events passed through to
> > custom views?
>
> > I need to handle the touch events in the custom view (not the
> > activity) because there are several custom views in the activity and
> > all of them need to respond individually to fling motions.  Detecting
> > fling events in the activity wont tell me over which view the fling
> > event happened.  So i would like to handle the touch events in the
> > custom view (its a better OO practice than handling it in the
> > Activity).
>
> > Any Clue?
>
> > --
> > 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
>
> --
> Romain Guy
> Android framework engineer
> romain...@android.com
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to