完成animationdrawable android后怎么能去新活动?

时间:2011-08-05 09:33:46

标签: android android-animation

我播放我的动画然后我想在我的动画完成时进行新的活动,但我没有! 我的代码在这里

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);
}

}

0 个答案:

没有答案