Is it possible to generate 2 animationdrawables at the same time?
I tried it with threads:
Thread t1 = new Thread(){
public void run(){
runOnUiThread(new Runnable() {
public void run()
{
animation1.start();
}
}};
Thread t2 = new Thread(){
public void run(){
runOnUiThread(new Runnable() {
public void run()
{
animation2.start();
}
}};
t1.start();
t2.start();
This doesn't work. I load the resources for the animation from a xml-file.
You call your code in onCreate() method and yes, it's wrong. If you check javaDoc for animationDrawable method start(), you will see you can't start in onCreate()
, but you should call it in onWindowFocusChanged(boolean)
method.