Android Splash Screen before black screen

后端 未结 2 1794
一整个雨季
一整个雨季 2021-01-14 19:15

I would like to display a splash screen while everything is initializing in the onCreate() method, yet components that I need to draw things to the screen are also initializ

2条回答
  •  离开以前
    2021-01-14 19:44

    //avoid time consuming work in UI thread but if that is related to UI itself then do as below

    @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
    
                setContentView(R.layout.first_splash_lauoy);
    
                new Handler().postDelayed(new Runnable() {
    
                    public void run() {
                      //Your time consuming work 
                      //with spiiner(if needed) & setContentView()
                      }, 1000);
            }
    
        }
    

提交回复
热议问题