SplashScreen Freezed不会带我去其他活动

时间:2019-07-28 11:45:07

标签: android-studio android-activity google-play

问候 我在我的应用程序上创建了一个启动画面,当我对其进行测试时,它被冻结,并且该应用程序没有将我带到另一个活动,我还设置了一个计时器“ 3秒”,然后它应该带我进入主要活动,但是它出现然后冻结了

public class Activity_SplashScreen extends AppCompatActivity {
Intent intent;
View mDecorView;
ImageView imageView;
TextView title;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash_screen);

    mDecorView = getWindow().getDecorView();

    hideSystemUI();

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            try {
                intent = new Intent(Activity_SplashScreen.this,Activity_SplashScreen.class);
                startActivity(intent);

                finish();
            } catch (Exception e) {

            }
        }
    }, 2000);
}

private void hideSystemUI() {
    // Set the IMMERSIVE flag.
    // Set the content to appear under the system bars so that the content
    // doesn't resize when the system bars hide and show.
    mDecorView.setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
                    | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
                    | View.SYSTEM_UI_FLAG_IMMERSIVE);
}

}

1 个答案:

答案 0 :(得分:1)

您正在开始学习同一门课。提供您要导航到的活动的类。您正从初始屏幕转到初始屏幕。