Silicon Valley social 2 -- welcome page, Silicon Valley social 2 --

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.