Silicon Valley social 2 -- welcome page, Silicon Valley social 2 --
SplashActivity
Public class SplashActivity extends Activity {private Handler handler = new Handler () {public void handleMessage (Message msg) {// if the current activity has exited, then I will not process the message if (isFinishing () {return ;}// determine whether to enter the home page or log on to the toMainOrLogin ();}}; // determine whether to enter the home page or log on to the private void toMainOrLogin () {// new Thread () {// public void run (){////}//}. start (); model.getinstance().getglobalthreadpool(cmd.exe cute (new Runnable () {@ Override public void run () {// determine whether the current account has logged on to if (EMClient. getInstance (). isLoggedInBefore () {// logged on // gets the information of the current logged on user UserInfo account = Model. getInstance (). getUserAccountDao (). getAccountByHxId (EMClient. getInstance (). getCurrentUser (); if (account = null) {// jump to the logon page Intent intent = new Intent (SplashActivity. this, loginaciti.pdf. class); startActivity (intent);} else {// method Model after successful logon. getInstance (). loginSuccess (account); // jump to the homepage Intent intent = new Intent (SplashActivity. this, MainActivity. class); startActivity (intent) ;}} else {// you have not logged on. // you can jump to the Intent intent = new Intent (SplashActivity. this, loginaciti.pdf. class); startActivity (intent) ;}// end the current page finish () ;}}) ;}@ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. activity_splash); // sends a delayed message handler for 2 seconds. sendMessageDelayed (Message. obtain (), 2000) ;}@ Override protected void onDestroy () {super. onDestroy (); // destroy the message handler. removeCallbacksAndMessages (null );}}
Create a full thread pool in the Model
private ExecutorService executorService = Executors.newCachedThreadPool();public ExecutorService getGlobalThreadPool() { return executorService;}
Github complete code: https://github.com/ganchuanpu/IM