How to start an activity in background and show it afterwards?

后端 未结 3 1043
青春惊慌失措
青春惊慌失措 2020-12-18 01:38

I\'ve two activities, one is the SplashActivity and the other is MainActivity, an activity containing a webview.

I need to load the webvi

3条回答
  •  自闭症患者
    2020-12-18 01:54

    i hope this should work perfectly...

       ProgressDialog pd;   
    
       pd = ProgressDialog.show(YOUR_ACTIVITY.this,"Loading...", true, false);
    
                new Thread(new Runnable() {
    
                    @Override
                    public void run() {
                        // TODO Auto-generated method stub
    
                        Intent intent = new Intent(YOUR_ACTIVITY.this,
                                NEXT_ACTIVITY.class);
    
                        startActivity(intent);
                        pd.dismiss();
                    }
                }).start();
    
            }
        });
    

提交回复
热议问题