I still don't understand why the different actions are connected, but
I did dig in and got my code to work; I hope this helps someone else:

I made a PressableButton subclass of Button with:

        OnPressListener onPressListener;
        boolean wasPressed = false;

        public PressableButton(Context context, AttributeSet attrs, int
defStyle) {
                super(context, attrs, defStyle);
                wasPressed = isPressed();
                setClickable(true);
        }

        protected void drawableStateChanged() {
                super.drawableStateChanged();
                if (wasPressed && !isPressed())
                        onPressListener.onPress();
                else if (!wasPressed && isPressed())
                        onPressListener.onRelease();
                wasPressed = isPressed();
        }
        public interface OnPressListener {public void onPress();public void
onRelease();}
        public void setOnPressable(OnPressListener onPressListener)
{this.onPressListener = onPressListener;}

Callers create and set an OnPressListener, similar to the
OnClickListener in the default Button.

The press handling handles the press and the release, the click
handler doesn't fire until the release.
--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to