Using java Syntax Highlighting
- public void onClick(View v){
- if (this.getBackground() == getResources().getDrawable(R.drawable.dead))
- this.setBackgroundDrawable(bg);
- else
- this.setBackgroundResource(R.drawable.dead);
- TextView tv = (TextView) ((Activity)ctx).findViewById(R.id.d1);
- if (tv != null)
- tv.setBackgroundDrawable(bg);
- }
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
I have a custom button class that extends Button and implements View.OnClickListener. What I am basically trying to do is compare what image is being using for the background of the button when it is clicked. I have looked through as much documentation as I could get my hands on and I thought this code would work, but the result from getResources().getDrawable(R.drawable.dead) is different everytime you click on the button. Any advice will be greatly appreciated.


