@Override protected void onResume() { super.onResume(); boolean finish = getIntent().getBooleanExtra("FINISH", false); if (finish) { // clear user profile ClientAuthentication.initProfile(); ClientAuthentication.clearGlobalVariables(); // clear trip, recommendations, etc. Storage.clearAll(); startActivity(new Intent(MainActivity.this, LoginActivity.class)); finish(); } else { /* GetBusStops */ if (Storage.isEmptyBusStops()) { getBusStops(); } /* GetRecommendations */ if (!Storage.isEmptyRecommendations()) { displayRecommendations(); } else { getRecommendations(); } } }