Hi!

Thanks for the help!
I have now implemented it the way you suggested, but the onSingleTapUp
is not firing.

This is what i have done:

// defined my own gesture detector:
class MyGestureDetector extends SimpleOnGestureListener {
    @Override
    public boolean onSingleTapUp(MotionEvent e) {
        Log.d(Config.LOG_TAG, "TABTAB");
        return super.onSingleTapUp(e);
    }
}

// created the gesture listener:
GestureDetector gestureDetector = new GestureDetector(new
MyGestureDetector());

View.OnTouchListener gestureListener = new View.OnTouchListener() {
    public boolean onTouch(View v, MotionEvent event) {
        boolean b = gestureDetector.onTouchEvent(event);
        Log.d(Config.LOG_TAG, "PLAY: " + b);
        return b;
    }
};


// add the gesture listener to my button:
ToggleButton playBtn =
(ToggleButton)v.findViewById(R.id.btn_list_play);
playBtn.setClickable(false);
playBtn.setOnTouchListener(gestureListener);


The onTouch() in gestureListener is fired. The call to
gestureDetector.onTouchEvent() always returns false.
The onSingleTapUp() in MyGestureDetector is never fired. If i
implement a onDown() in MyGestureDetector it IS fired.
Can anyone explain me why?

Thanks,
Anton







On Mar 15, 10:03 am, NapoleonLiu <liuwa...@neusoft.com> wrote:
> Hi
>   I have the same problem , at last i do it like this
> I write two GestureListener, implement onSingleTapUp method.
> set both the button and other view's clickable to false
> and set them OnTouchListener(NOT onClickListener) with GestureListener.
> if you haven't used GestureListener, you can learn it from ApiDemos.
>
>
>
> On Mon, 15 Mar 2010 16:26:32 +0800,AntonPirker <an...@ignaz.at> wrote:
> > Hello List!
>
> > I have a problem that some other people on this list (and other android  
> > sites) also have/had, but was unable to find a solution.
> > I have a ListView with a custom view for the row which looks like this:
>
> > <RelativeLayout>
> >     <ToggleButton/>
> >     <TextView/>
> > </RelativeLayout>
>
> > Its basically a list of songs that i show. What i want to achieve:
>
> > If the user clicks on the ToggleButton the song should be played.
> > If the user clicks somewhere else on the row, the details intent of the  
> > song should be launched.
>
> > So I want to have two events on every row, event1: the button click,  
> > event2: click somewhere except on the button.
>
> > Right now i have a custom adapter where i call .setOnClickListener() on  
> > the button. Now the button works (event1 works), the song is played, but  
> > the rest of the row is not clickable (event2 does not work). If i remove  
> > the call to setOnClickListener() the row is clickable (event1 works) and  
> > the details are displayed as suppossed, but the button is not working.  
> > (event1 does not work)
>
> > There are apps out there, that have buttons in lists so this must be  
> > possible.
> > Could someone please tell me how to have more than one click event on a  
> > lists row?
>
> > I have found a solution that reads: "You have to use TouchDelegate" But  
> > i do not have a clue how! If someone knows how a solution with  
> > TouchDelegate looks like, please explain it to me!
>
> > Thanks,
> >Anton
>
> ---------------------------------------------------------------------------------------------------
> Confidentiality Notice: The information contained in this e-mail and any 
> accompanying attachment(s)
> is intended only for the use of the intended recipient and may be 
> confidential and/or privileged of
> Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of 
> this communication is
> not the intended recipient, unauthorized use, forwarding, printing,  storing, 
> disclosure or copying
> is strictly prohibited, and may be unlawful.If you have received this 
> communication in error,please
> immediately notify the sender by return e-mail, and delete the original 
> message and all copies from
> your system. Thank you.
> ---------------------------------------------------------------------------------------------------

-- 
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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to