首页 > 代码库 > android启动页延时跳转

android启动页延时跳转

package com.goodness.goodness;

import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;

public class MainActivity extends AppCompatActivity {
    private Context context = MainActivity.this;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        去掉TitleBar(需要放到setContentView上面)
//        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main);

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent intent = new Intent(context, IndexActivity.class);//设置调转页面
                startActivity(intent);//跳转
                finish();//销毁当前页面
            }
        }, 3000);


    }
}

 

android启动页延时跳转