I want to change the background image of a button when clicked or focused.
This is my code:
Button tiny = (Button)findViewById(R.id.tiny);
tiny.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Button tiny = (Button)findViewById(R.id.tiny);
tiny.setBackgroundResource(R.drawable.a9p_09_11_00754);
TextView txt = (TextView)findViewById(R.id.txt);
txt.setText("!---- On click ----!");
}
});
Is this code right? Does it calls a button on its event?