Мне не совсем понятно, почему вы не можете запускать анимации из потока onCreate, они должны быть отправлены в любой поток, в котором был создан обработчик представления.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final ImageView view = (ImageView) findViewById(R.id.shell);
view.setVisibility(ImageView.VISIBLE);
view.setBackgroundResource(R.drawable.animation_frame);
view.post(new Runnable(){
public void run(){
AnimationDrawable frameAnimation = (AnimationDrawable) view.getBackground();
frameAnimation.start();
}
});
}
}
Понятия не имею, зачем вам это делать, но вы делаете.
edit: Вот отрывки из моего рабочего проекта должны быть все, что вам нужно ...
в Java в onCreate:
final ImageView image1 = (ImageView) v.findViewById(R.id.coin1);
image1.post(new Runnable() {
@Override
public void run() {
AnimationDrawable ani = (AnimationDrawable) image1.getBackground();
ani.start();
}
});
в формате xml:
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/coin"
android:id="@+id/coin1"/>
монета xml:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
<item android:drawable="@drawable/coin_spin_a" android:duration="100"/>
<item android:drawable="@drawable/coin_spin_b" android:duration="100"/>
<item android:drawable="@drawable/coin_spin_c" android:duration="100"/>
<item android:drawable="@drawable/coin_spin_d" android:duration="100"/>
<item android:drawable="@drawable/coin_spin_e" android:duration="100"/>
<item android:drawable="@drawable/coin_spin_f" android:duration="100"/>
</animation-list>