Thanks Niko20 for your answer...

Do you have any idea how game running Android 2.0+ do ?

On 28 nov, 15:21, niko20 <[email protected]> wrote:
> Unfortunately Android's multitouch design is completely idiotic and
> does not allow multitouch events to go to two different views at the
> same time. You can only capture multitouch on *one* view.
>
> I guess in Android 3.2 they now allow multitouch to go the multiple
> views. But I have not tested it.
>
> Whoever thought of the one view thing is a moron, period. It should
> have just worked. But noooooo. We are Google we do everything the hard
> way.
>
> -niko
>
> On Nov 28, 8:13 am, ColletJb <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I'm facing an very simple (and stupid) issue and I hope someone will
> > be able to provide me an explanation...
>
> > I'm trying to develop an Activity with 2 buttons (let's call them btnA
> > and btnB), they are in my xml layout. My goal is to be able to handle
> > click on both button (easy), even on the same time with multi-touch.
>
> > First, I retrieve them on the onCreate method and I set them the
> > OnTouchListener to this (my Activity implements OnTouchListener):
>
> > @Override
> >         public void onCreate(Bundle savedInstanceState) {
> >                 super.onCreate(savedInstanceState);
> >                 setContentView(R.layout.main);
>
> >                 this.btnA = (ImageButton) this.findViewById(R.id.btnA);
> >                 this.btnB = (ImageButton) this.findViewById(R.id.btnB);
>
> >                 this.btnA.setOnTouchListener(this);
> >                 this.btnB.setOnTouchListener(this);
> >         }
>
> > I did override the onTouch method that way :
> > @Override
> >         public boolean onTouch(View v, MotionEvent event) {
> >                 int action = event.getAction() & MotionEvent.ACTION_MASK;
> >                 if(v.equals((View)this.btnA)){
> >                         if(action == MotionEvent.ACTION_DOWN){
> >                                 updateAState(true);
> >                         }else if(action == MotionEvent.ACTION_UP){
> >                                 updateAState(false);
> >                         }
> >                 }else if(v.equals((View)this.btnB)){
> >                         if(action == MotionEvent.ACTION_DOWN){
> >                                 updateBState(true);
> >                         }else if(action == MotionEvent.ACTION_UP){
> >                                 updateBState(false);
> >                         }
> >                 }
> >                 return true;
> >         }
>
> > With this implementation, I can capture the DOWN and UP event on both
> > buttons, but not with multi-touch (ex: btnA DOWN, btnB DOWN, btnB UP,
> > btnB DOWN, btnB UP, btnA UP).
>
> > Who can tell me how I can fix my onTouch method to support such
> > feature ?
>
> > Thanks a lot.

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