启动画面取决于点击继续

Splash screen depends onClick to move on

目前,我的启动画面直接 link 到我的 mainActivity。旋转持续时间结束时,启动画面结束。 android:duration="8000"

然后我在最后有警告对话框。

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);


        final ImageView iv = (ImageView) findViewById(R.id.imageView);
        final Animation an = AnimationUtils.loadAnimation(getBaseContext(), R.animator.rotate);
        final Animation an2 = AnimationUtils.loadAnimation(getBaseContext(), R.anim.abc_fade_out);

        iv.startAnimation(an);
        an.setAnimationListener(new Animation.AnimationListener() {


            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                iv.startAnimation(an2);
                finish();
                Intent i = new Intent(getBaseContext(), MainActivity.class);
                startActivity(i);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });
        new AlertDialog.Builder(this).setTitle("Promo Code").setMessage("Type in 'VC2001' for a 10% discount. Only applicable for VC-20U").setNeutralButton("Close", null).show();

    }
`

那么,有没有什么办法可以在我点击关闭后结束启动画面?

这听起来可能真的很愚蠢,因为我是 android

的新手
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(yoursplashscreen.this);

       dialogBuilder.setTitle("Promo Code");
dialogBuilder.setMessage("Type in 'VC2001' for a 10% discount. Only applicable for VC-20U");


        dialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
                // finish your splash screen here and set intent to your new activity
                finish();
                Intent i = new Intent(getBaseContext(), MainActivity.class);
                startActivity(i);
            }
        });
        AlertDialog alertDialog = dialogBuilder.create();
        alertDialog.show();