title: Android splash screen and server communication
body: <p>I am developing an application in android, where i need to display a splash screen and at the same time there will be server communication. The problem here is when i launch the app, first application is communicating with the server and then it is displaying the splash screen. I want to both server communication and splash screen at the same time.</p>
  
  <p>The following is my code:</p>
  
  <pre><code> protected void onCreate(Bundle savedInstanceState) {
  
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.splash_screen);
  
      try {
  
          Thread thread = new Thread(this);
  
          thread.start();
  
          thread.join();
  
          //Attractions
          CommonMethods.getSystemOutput("Response Json Array String Attractions:::"+jArrayMobileAttractions);
  
          attractionsDate = JsonParsing.getLatestDate(jArrayMobileAttractions);
  
          attractionsDate = getDate(attractionsDate);
  
          CommonMethods.getSystemOutput("Attractions Date:::::"+attractionsDate);
  
          //Categories
          CommonMethods.getSystemOutput("Response Json Array String Categories:::"+jArrayCategories);
  
          categoryDate = JsonParsing.getLatestDate(jArrayCategories);
  
          categoryDate = getDate(categoryDate);
  
          CommonMethods.getSystemOutput("Category date:::"+categoryDate);
  
          //Contacts
          CommonMethods.getSystemOutput("Response Json Array String Contacts:::"+jArrayContacts);
  
          contactsDate = JsonParsing.getLatestDate(jArrayContacts);
  
          contactsDate = getDate(contactsDate);
  
          CommonMethods.getSystemOutput("Contacts Date:::"+contactsDate);
  
      } catch (Exception e) {
  
          CommonMethods.getSystemOutput("Exception in Splash screen thread:::"+e);
      }
  
  }
  
  public void run() {
  
  //      if (attractionsDate == null) {
  
          jArrayMobileAttractions = RequestHandler.getJSONfromURL(Constants.MOBILE_ATTRACTIONS_URL);
  
          jArrayCategories = RequestHandler.getJSONfromURL(Constants.CATEGORY_URL);
  
          jArrayContacts = RequestHandler.getJSONfromURL(Constants.CONTACTS_URL);
  
  
  //      } else {
  
  //          jArrayMobileAttractions = RequestHandler.getJSONfromURL(Constants.MOBILE_ATTRACTIONS_URL+"?lastupdateddate="+attractionsDate);
  
  //      }
  
  }
  </code></pre>