Buggy code:
public final String [ ] mFragments = new String [ ] { "mobile.tiis.app.fragments.HomeFragment" , "mobile.tiis.app.fragments.HomeFragment" , "mobile.tiis.app.fragments.RegisterChildFragment" , "mobile.tiis.app.fragments.SearchChildFragment" , "mobile.tiis.app.fragments.VaccinationQueueFragment" , "mobile.tiis.app.fragments.ReportsFragment" , "mobile.tiis.app.fragments.MonthlyPlanFragment" , "mobile.tiis.app.fragments.StockFragment" , "mobile.tiis.app.fragments.RegisterChildFragment" } ; public final String HOME_FRAGMENT = "mobile.tiis.app.fragments.HomeFragment" ; public final String REGISTER_CHILD_FRAGMENT = "mobile.tiis.app.fragments.RegisterChildFragment" ; public final String SEARCH_CHILD_FRAGMENT = "mobile.tiis.app.fragments.SearchChildFragment" ; public final String VACCINATION_QUEUE_FRAGMENT = "mobile.tiis.app.fragments.VaccinationQueueFragment" ; public final String REPORTS_FRAGMENT = "mobile.tiis.app.fragments.ReportsFragment" ; public final String MONTHLY_PLAN_FRAGMENT = "mobile.tiis.app.fragments.MonthlyPlanFragment" ; public final String STOCK_FRAGMENT = "mobile.tiis.app.fragments.StockFragment" ; public final String LOGOUT = "logout" ; public String currentFragment = "" ; public Toolbar toolbar ; private boolean sync_needed ; private FrameLayout frameLayout ; private SharedPreferences sync_preferences ; private SharedPreferences login_preferences ; public static final String LOGINPREFERENCE = "loginPrefs" ; public Builder alertDialogBuilder ; private BroadcastReceiver receiver = new BroadcastReceiver ( ) { @ Override public void onReceive ( Context context , Intent intent ) { } } ; @ Override protected void onCreate ( Bundle starter ) { super . onCreate ( starter ) ; Log . e ( HomeActivityRevised . TAG , HomeActivityRevised . TAG ) ; setContentView ( homeactivity_redesigned ) ; setupTypeface ( this ) ; initializeViews ( ) ; Log . d ( HomeActivityRevised . TAG , "starting<seq2seq4repair_space>my<seq2seq4repair_space>service" ) ; final BackboneApplication app = ( ( BackboneApplication ) ( getApplication ( ) ) ) ; if ( ( ( ( app . getLOGGED_IN_FIRSTNAME ( ) ) != null ) && ( ( app . getLOGGED_IN_LASTNAME ( ) ) != null ) ) && ( ( app . getUsername ( ) ) != null ) ) { TextView welcomeText = ( ( TextView ) ( nv . getHeaderView ( 0 ) . findViewById ( welcome_username ) ) ) ; welcomeText . setText ( ( ( ( ( ( ( ( app . getLOGGED_IN_FIRSTNAME ( ) ) + "<seq2seq4repair_space>" ) + ( app . getLOGGED_IN_LASTNAME ( ) ) ) + "<seq2seq4repair_space>" ) + "(" ) + ( app . getUsername ( ) ) ) + ")" ) ) ; } else { forceLogout ( ) ; } LayoutInflater li = LayoutInflater . from ( this ) ; View promptsView = li . inflate ( custom_alert_dialogue , null ) ; alertDialogBuilder = new AlertDialog . Builder ( this ) ; alertDialogBuilder . setView ( promptsView ) ; TextView message = ( ( TextView ) ( promptsView . findViewById ( dialogMessage ) ) ) ; message . setText ( "App<seq2seq4repair_space>Synchronising....<seq2seq4repair_space>Please<seq2seq4repair_space>Wait!" ) ; alertDialogBuilder . setCancelable ( false ) ; login_preferences = getSharedPreferences ( HomeActivityRevised . LOGINPREFERENCE , MODE_PRIVATE ) ; fm = new FragmentStackManager ( this ) ; String lastFragment = app . LAST_FRAGMENT ; String lastFragmentTitle = app . LAST_FRAGMENT_TITLE ; if ( starter == null ) { FragmentTransaction tx = getSupportFragmentManager ( ) . beginTransaction ( ) ; tx . replace ( content_frame , Fragment . instantiate ( this , lastFragment ) ) ; tx . addToBackStack ( lastFragment ) ; toolbarTitle . setText ( lastFragmentTitle ) ; tx . commit ( ) ; } else { } if ( ( toolbar ) != null ) { setSupportActionBar ( toolbar ) ; final ActionBar actionBar = getSupportActionBar ( ) ; actionBar . setHomeAsUpIndicator ( ic_menu_white_24dp ) ; getSupportActionBar ( ) . setDisplayHomeAsUpEnabled ( true ) ; getSupportActionBar ( ) . setHomeButtonEnabled ( true ) ; } sync_preferences = PreferenceManager . getDefaultSharedPreferences ( getApplicationContext ( ) ) ; sync_needed = true ; boolean secondSyncNeeded = false ; boolean firstLoginOfDaySyncNeeded = false ; sync_needed = sync_preferences . getBoolean ( "synchronization_needed" , true ) ; <START_BUG> secondSyncNeeded = sync_preferences . getBoolean ( "secondSyncNeeded" , false ) ; <END_BUG> firstLoginOfDaySyncNeeded = sync_preferences . getBoolean ( "firstLoginOfDaySyncNeeded" , false ) ; if ( ( ( ( app . getLOGGED_IN_FIRSTNAME ( ) ) == null ) && ( ( app . getLOGGED_IN_LASTNAME ( ) ) == null ) ) && ( ( app . getUsername ( ) ) == null ) ) { Log . d ( "CHECHINGLOGOUT" , "No<seq2seq4repair_space>user<seq2seq4repair_space>creds<seq2seq4repair_space>found<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>application<seq2seq4repair_space>upon<seq2seq4repair_space>starting<seq2seq4repair_space>the<seq2seq4repair_space>activiry" ) ; performLogout ( ) ; } else { if ( ( ( Utils . isOnline ( this ) ) && ( sync_needed ) ) && ( app . getMainSyncronizationNeededStatus ( ) ) ) { new HomeActivityRevised . mainSynchronisation ( ) . execute ( 0 ) ; } else if ( ( Utils . isOnline ( this ) ) && firstLoginOfDaySyncNeeded ) { if ( ( VERSION . SDK_INT ) >= ( VERSION_CODES . HONEYCOMB ) ) new HomeActivityRevised . firstLoginOfDaySynchronisation ( ) . executeOnExecutor ( THREAD_POOL_EXECUTOR , 0 ) ; else new HomeActivityRevised . firstLoginOfDaySynchronisation ( ) . execute ( 0 ) ; } else if ( ( Utils . isOnline ( this ) ) && secondSyncNeeded ) { Log . e ( "RUBIN" , "RUBIN<seq2seq4repair_space>secondSyncNeeded" ) ; if ( ( VERSION . SDK_INT ) >= ( VERSION_CODES . HONEYCOMB ) ) new HomeActivityRevised . updateSynchronisation ( ) . executeOnExecutor ( THREAD_POOL_EXECUTOR , 0 ) ; else new HomeActivityRevised . updateSynchronisation ( ) . execute ( 0 ) ; } RoutineAlarmReceiver . setAlarmCheckForChangesInChild ( this ) ; RoutineAlarmReceiver . setPostmanAlarm ( this ) ; nv . setNavigationItemSelectedListener ( new NavigationView . OnNavigationItemSelectedListener ( ) { @ Override public boolean onNavigationItemSelected ( MenuItem item ) { item . setChecked ( true ) ; drawerLayout . closeDrawers ( ) ; switch ( item . getItemId ( ) ) { case id . drawer_home : if ( app . saveNeeded ) { app . LAST_FRAGMENT = HOME_FRAGMENT ; alertUserLeavingScreen ( HOME_FRAGMENT , getString ( home ) ) ; } else { app . LAST_FRAGMENT = HOME_FRAGMENT ; app . LAST_FRAGMENT_TITLE = getString ( home ) ; changeFragment ( HOME_FRAGMENT , getString ( home ) ) ; } break ; case id . reg_child : if ( app . saveNeeded ) { app . LAST_FRAGMENT = REGISTER_CHILD_FRAGMENT ; alertUserLeavingScreen ( REGISTER_CHILD_FRAGMENT , getString ( home_register_child ) ) ; } else { app . LAST_FRAGMENT = REGISTER_CHILD_FRAGMENT ; app . LAST_FRAGMENT_TITLE = getString ( home_register_child ) ; changeFragment ( REGISTER_CHILD_FRAGMENT , getString ( home_register_child ) ) ;

Fix:
secondSyncNeeded = false ;