I know that I can launch the OnClickListener.onClick buttons manually in the code by calling the performClick function, but this does not look like a visual display since it was clicked. I am looking for a way to manually make a button as if it were pressed. Do I need to manually change the wallpaper and cancel (and then change it again to calling Handler.postDelayed), or is there a way to do this in my pocket?
EDIT
I know how to make a button display different patterns when a user starts printing. The question is:
Is there an easy way to make a button pressed programmatically if the user has not physically pressed?
Decision
I simply subclassed Button and made the button aware of this normal background as StateListDrawable and Drawable, which is used as the pressed state. I am exposing a method that manually sets the background to a "clicked" drawable, and I use Handler.postAtTime to return it to a normal background so that it can be used again as a regular button when I am done.
source
share