On Sep 28, 2012, at 11:45 PM, Streets Of Boston <[email protected]> wrote:
> Is there a reliable or proper way to prevent a click of multiple buttons at
> the same time, e.g. a second button won't click when another finger is still
> down on the screen?
I don't know whether this is a proper nor reliable way but managed to prevent
multiple buttons from being triggered at the same time with following code. It
allows user to select multiple buttons as a chord but will hook at the last
pointer up event only.
// R.id.button1, R.id.button2, etc...
findViewById(R.id.buttonX).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ViewGroup group = (ViewGroup)findViewById(R.id.container);
for (View touchable : group.getTouchables()) {
if (touchable != view && touchable.isPressed()) {
Log.d("...", "skip");
}
}
}
});
--
H
--
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