@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_lobby); gameToJoin = getIntent().getIntExtra(JOIN_GAME_EXTRA, -1); if (gameToJoin != -1) { // We started from a notification => make sure basic initializations, normally // made in MainActivity are performed here: GameSettings.setProfile(Profile.Load(PreferenceManager.getDefaultSharedPreferences(this))); DrawableManager.InitializeCache(5); } dataServer = new HttpConnector(getString(R.string.dataserver_url)); ListView lobbyList = (ListView) findViewById(R.id.mainList); checkBoxView = (CheckBox) findViewById(R.id.spectatorCheckboxView); lobbyList.setClickable(true); listGames(); if (GameSettings.getLastPlayTime() != -1) { // A game has been played, push new playtime to server dataServer.sendRequest( ServerCommand.SET_PLAYTIME, ImmutableMap.of( "id", String.valueOf(GameSettings.getUserId()), "token", GameSettings.getPlayerToken(), "playtime", String.valueOf( GameSettings.getProfile().getPlaytime() + GameSettings.getLastPlayTime())), new HttpConnector.Callback() { @Override public void handleResult(String data) {} }); GameSettings.resetLastPlaytime(); } }