@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // setContentView(R.layout.splash);
    getWindow()
        .setWindowAnimations(
            0); // Do not animate the view when it gets pushed on the screen
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

    // MyStateSaver data = (MyStateSaver) getLastNonConfigurationInstance();

    CustomApp appState = ((CustomApp) getApplicationContext());
    unzippedDir = appState.getUnzippedDir();
    authenticationUrl = appState.getAuthenticationUrl();
    unzippedRoot = appState.getUnzippedRoot();

    languageSelected = appState.getLanguage();
    Locale locale = new Locale(languageSelected);
    Locale.setDefault(locale);
    Configuration config = new Configuration();
    config.locale = locale;
    getBaseContext()
        .getResources()
        .updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());

    oc = new OnlineCheck(); // check online connection

    // Check if an SDCard exists. If it does then check if the PlaceBooks dir exists.
    // If it does not exist then create it. If there is no SDCard then alert user they need one.
    SDCardCheck sdcardcheck = new SDCardCheck();
    if (sdcardcheck.isSdPresent()) {
      // SDCard IS mounted. Now check if PlaceBooks root dir exists. Create it when app first starts
      // up.
      File directory = new File(unzippedDir);

      if (!directory.exists()) {
        // Create the placebooks root directory on the SDCard
        directory = new File(unzippedDir);
        directory.mkdirs();
      } else {
        // Directory exists so do nothing
      }
    } else {
      // SDCard is not mounted. Alert user.
      Log.d("Placebooks", getResources().getString(R.string.no_sdcard));

      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      builder.setTitle(getResources().getString(R.string.no_sdcard));
      builder.setMessage(getResources().getString(R.string.sdcard_needed));
      builder.setPositiveButton(getResources().getString(R.string.ok), null);
      builder.show();
    }

    /*
    //Get the app's shared preferences - check if a user connected their account to the app
    SharedPreferences loginAppPreferences = this.getSharedPreferences("LOGIN_DETAILS", MODE_PRIVATE);
    strUserName = loginAppPreferences.getString("username", "");
    strPassword = loginAppPreferences.getString("password", "");

    if (data != null) {
         // Show splash screen if still loading
         if (data.showSplashScreen) {
             showSplashScreen();
         }
         if (strUserName != ""){

     Intent intent = new Intent();
     //intent.setClassName("org.placebooks.www", "org.placebooks.www.Shelf");
     intent.setClassName("org.placebooks.www", "org.placebooks.www.TabLayoutActivity");
     intent.putExtra("username", strUserName);  //pass the username variable along as an extra in the Intent object, and then retrieve it from the newly launched Activity in the Shelf class
     //intent.putExtra("password", password);
     startActivity(intent);
     mSplashDialog.dismiss();
     endThisActivity();	//kill the placebooks activity

      }

      else{
       //First time using the app on the phone so let user log in..

      presentLogin();

      } //end of else

         // Rebuild your UI with your saved state here
    } else {
        showSplashScreen();
         if (strUserName != ""){

     Intent intent = new Intent();
     //intent.setClassName("org.placebooks.www", "org.placebooks.www.Shelf");
     intent.setClassName("org.placebooks.www", "org.placebooks.www.TabLayoutActivity");
     intent.putExtra("username", strUserName);  //pass the username variable along as an extra in the Intent object, and then retrieve it from the newly launched Activity in the Shelf class
     //intent.putExtra("password", password);
     startActivity(intent);
     mSplashDialog.dismiss();
     endThisActivity();	//kill the placebooks activity

      }

      else{
       //First time using the app on the phone so let user log in..

      presentLogin();

      } //end of else
         // Do your heavy loading here on a background thread
    }
    */

    // User isn't logged in so let them log in
    presentLogin();
  } // end of onCreate()