Try this. compteurView.startAnimation(animationCompteur); In my case, starting animation from Animation instance didn't work when that event caused by click ImageButton. (works internally but not displayed) So I've tried start from view, and that worked. I don't know the difference between them exactly.
On Dec 9, 6:07 pm, arnouf <arnaud.far...@gmail.com> wrote: > Hi all, > > I've a strange issue related an animation loaded automatically > building the content of a Tabhost : start is called correctly bu there > is no animation ! > > The goal is to load an animation when user is on the first tab of a > list of 4 different tabs. > > I created an xml file describing my tabhost. Each tab contains a > relativelayout. In the first relativelayout, included in the first > tab, I added an ImageView component. > > I created an XML file describing my animation in /res/anim > <animation-list xmlns:android="http://schemas.android.com/apk/res/ > android" > android:oneshot="false" android:visible="true"> > <item android:drawable="@drawable/imgone" android:duration="800" / > > <item android:drawable="@drawable/imgwo" android:duration="800" /> > <item android:drawable="@drawable/imgthree" > android:duration="800" /> > </animation-list> > > To load this animation and apply it on my ImageView, I load the layout > in my activity and apply on TabHost a listener OnTabChangeListener. > If the selected tab is the first I do following code : > ImageView compteurView = (ImageView) findViewById(R.id.animcompteur); > compteurView.setBackgroundResource(R.anim.anim_compteur); > AnimationDrawable animationCompteur = (AnimationDrawable) > compteurView.getBackground(); > animationCompteur.start(); > > At the end of my onCreate method in my Activity, I do a setcurrenttab > (0). My listener code is called correctly (debug mode) and even if > start is called, my view doesn't display the animation (just the first > image). If I go on another tab and come back on the first (index 0), > animation is started correctly. > > I hope that these explanation will be sufficient to understand my > problem. > > Thanks by advance for your help. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en