I am working on a small animation with android and I have a problem when running it.
These are the files I work with:
my animation:
animation-list... android:oneshot="false"
<item
android:drawable="@drawable/android01"
android:duration="5" />
<item
android:drawable="@drawable/android02"
android:duration="5" />
<item
android:drawable="@drawable/android03"
android:duration="5" />
<item
android:drawable="@drawable/android04"
android:duration="5" />
<item
android:drawable="@drawable/android05"
android:duration="5" />
<item
android:drawable="@drawable/android06"
android:duration="5" />
<item
android:drawable="@drawable/android07"
android:duration="5" />
<item
android:drawable="@drawable/android08"
android:duration="5" />
<item
android:drawable="@drawable/android09"
android:duration="5" />
<item
android:drawable="@drawable/android10"
android:duration="5" />
<item
android:drawable="@drawable/android11"
android:duration="5" />
<item
android:drawable="@drawable/android12"
android:duration="5" />
<item
android:drawable="@drawable/android13"
android:duration="5" />
<item
android:drawable="@drawable/android14"
android:duration="5" />
<item
android:drawable="@drawable/android15"
android:duration="5" />
<item
android:drawable="@drawable/android16"
android:duration="5" />
<item
android:drawable="@drawable/android17"
android:duration="5" />
<item
android:drawable="@drawable/android18"
android:duration="5" />
<item
android:drawable="@drawable/android19"
android:duration="5" />
<item
android:drawable="@drawable/android20"
android:duration="5" />
<item
android:drawable="@drawable/android21"
android:duration="5" />
<item
android:drawable="@drawable/android22"
android:duration="5" />
<item
android:drawable="@drawable/android23"
android:duration="5" />
... This would be the activity code:
AnimationDrawable anim;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView and=(ImageView)findViewById(R.id.imageView);
and.setBackgroundResource(R.drawable.framebyframe);
anim=(AnimationDrawable) and.getBackground();
anim.start();
}
And this is the error:
Raphael, the error shown in the LogCat is:
You must take into account that the images must be optimized, it is not necessary to load images of a considerable size since the operating system could have problems handling them in memory and can consume considerable memory, after all they will be displayed on a mobile device.
deal with smaller versions of your images.
Check the optimization tips for images in this answer:
https://es.stackoverflow.com/a/6359/95
https://sites.google.com/site/ticvalcarcel/optimizacion-de-imagenes-para-internet/size-and-weight-of-images