1

I have a very simple widget that has a background image of a speech bubble and an imageView that contains a character standing next to it (as if he is saying something). On top of the speech bubble i have a textView in which i show some text.

Basically all i want to do is so that when the user clicks on the character the image changes to show an animation of the character.

I did a simple app that animates an imageView (using the animation-list xml) when the image is clicked and that worked fine. So i was wondering if i could achieve the same thing with this widget.

I have seen some examples where by you can click on a widget (be it a button, image, whatever) and you can then load a config layout however i simply cant figure out and i cant find anywhere if what i want can be done.

So basically what i need to know is: 1. can a widget have an animated imageView 2. What do i need to do so that when the imageView is clicked it loads the animation?

Can anyone point me in the right direction please?

Thanks in advance guys!!

Alex
  • 11
  • 2

1 Answers1

-1

Have you tried to use LayoutAnimation? See the related question here: Android Widgets: Animations on RemoteViews ?

Community
  • 1
  • 1
Thanasis Petsas
  • 4,378
  • 5
  • 31
  • 57
  • no, but even if i did, how would i trigger the animation when i click on the image? – Alex Mar 31 '11 at 13:52
  • I suppose you have to write something like this: `imgBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { img.startAnimation(youAnimation); } });` Maybe this is helpful: http://stackoverflow.com/questions/2651070/how-to-make-button-with-custom-background-image-show-click-animation-in-android – Thanasis Petsas Mar 31 '11 at 14:13
  • I don't know exactly how is your app, but I think that maybe it's better not to use another class to do it. You can just override the onUpdate method to give extra functionality.. – Thanasis Petsas Mar 31 '11 at 14:53
  • Yes Thanasis, thats right. Thats what i have done thank you.i cant believe its not as simple as just telling it to change the image background and use the animation list :| I mean the main problem is that with the remoteView i cant use the findViewById, so i cant assign the animation list to the imageView. – Alex Mar 31 '11 at 14:53