android button setPressed after onClick
Posted
by
strem
on Stack Overflow
See other posts from Stack Overflow
or by strem
Published on 2011-05-12T08:14:43Z
Indexed on
2012/10/15
9:38 UTC
Read the original article
Hit count: 270
yesterday I noticed the possibility to integrate Fragments in older API Levels through the Compatibility package, but thats not really essential for the question. :)
I have a Button with an OnClickListener
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
doSomething();
button.setPressed(true);
}
});
Because of the actual clicking, it is shown as pressed and after releasing the click, the button state is not pressed and stays that way.
Is there a simple way that keeps the button state pressed after releasing? First thing I can think of would be some sort of timer, but that seems unreasonable.
© Stack Overflow or respective owner