I have successfully set an image to an ImageButton using this code:
mGetClickTime.setImageResource(randomImageId);
But I'm trying to problematically change the image by calling a method which contains:
mGetClickTime.setImageResource(randomImageId);
(In which the randomImageId vraiable is different)
However the programmatic change is not working.
Do I need to remove the current image before setting a new one? If so, how do I do that?
EDIT
The problem seems to be that the above command stops working after another activity has been called and completed. After that happens the setImageResource just doesn't work.
I'm not sure why this could be. I've tried commenting out everything from the second activity apart from this
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
but the problem still occurs. Why?