how can go new activity when finish animationdrawable android?
i play my animation then i want to new activity when my animation is finished but i did not! My code is here
public class Splash extends Activity {
protected boolean active = true;
protected int splashTime = 21 * 75; // time to display the splash screen in
// ms
protected ImageView img = null;
ArrayList<Integer> arr = new ArrayList<Integer>();
int i = 0;
AnimationDrawable animation;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
WindowManager.LayoutParams.FLAG开发者_开发知识库_FORCE_NOT_FULLSCREEN);
setContentView(R.layout.splash);
animation = new AnimationDrawable();
animation.addFrame(getResources().getDrawable(R.drawable.s01), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s02), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s03), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s04), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s05), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s06), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s07), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s08), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s09), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s10), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s11), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s12), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s13), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s14), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s15), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s16), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s17), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s18), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s19), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s20), 75);
animation.addFrame(getResources().getDrawable(R.drawable.s21), 75);
animation.setOneShot(true);
ImageView imageAnim = (ImageView) findViewById(R.id.imgSplash);
imageAnim.setBackgroundDrawable(animation);
imageAnim.post(new Starter());
}
class Starter implements Runnable {
public void run() {
animation.start();
}
}
public void Go()
{
Intent i =new Intent();
i.setClass(this, Main.class);
startActivity(i);
}
}
精彩评论