1

I want to create a button animation with two image on an ImageView programmiticaly only and by using onClickListener. I have two image that i can set with setImageResource() fonction but i don't know how to play the button animation before the button action launches.

J. GOT
  • 21
  • 4

1 Answers1

0

Please, could you explain a bit more what you are wanting? Do you want to replace the ImageButton resource when you click on it? You can achieve it setting the OnClickListener

new View.OnClickListener() { public void onClick(View v) { imageButtonView.setImageResource(idOfTheNewResource); } };

Is this what you are wanting?

Augusto Carmo
  • 4,386
  • 2
  • 28
  • 61
  • I actually make this but, my shapeview start another activity and when i come back in my precedent activity which contain my button, it stay with the ressource that i apply before. What i want is to resotre the first image with setImageResource() after i change of activity. – J. GOT Aug 27 '16 at 16:32
  • The first image is the state when the imageview isn't pressed and the other when it is. I want to restore the first image just after realise my redirection (or my click, or in my click before start the redirection). – J. GOT Aug 27 '16 at 16:34
  • Now I understand what you want, I'll comment your question. – Augusto Carmo Aug 27 '16 at 16:36