Buggy code:
public class ActiveFileDownloadsFragment extends Fragment { private BroadcastReceiver onFileQueuedReceiver ; private BroadcastReceiver onFileDownloadedReceiver ; private LocalBroadcastManager localBroadcastManager ; @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Nullable @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { final RelativeLayout viewFileslayout = ( ( RelativeLayout ) ( inflater . inflate ( layout_downloads , container , false ) ) ) ; final ProgressBar progressBar = ( ( ProgressBar ) ( viewFileslayout . findViewById ( pbLoadingItems ) ) ) ; final ListView listView = ( ( ListView ) ( viewFileslayout . findViewById ( lvItems ) ) ) ; listView . setVisibility ( INVISIBLE ) ; progressBar . setVisibility ( VISIBLE ) ; LibrarySession . GetActiveLibrary ( getActivity ( ) , new com . vedsoft . futures . runnables . TwoParameterRunnable < FluentTask < Integer , Void , Library > , Library > ( ) { @ Override public void run ( FluentTask < Integer , Void , Library > owner , Library library ) { final StoredFileAccess storedFileAccess = new StoredFileAccess ( getActivity ( ) , library ) ; storedFileAccess . getDownloadingStoredFiles ( new com . vedsoft . futures . runnables . TwoParameterRunnable < FluentTask < Void , Void , List < StoredFile > > , List < StoredFile > > ( ) { @ Override public void run ( FluentTask < Void , Void , List < StoredFile > > owner , final List < StoredFile > storedFiles ) { final ActiveFileDownloadsAdapter activeFileDownloadsAdapter = new ActiveFileDownloadsAdapter ( getActivity ( ) , SessionConnection . getSessionConnectionProvider ( ) , storedFiles ) ; if ( ( onFileDownloadedReceiver ) != null ) localBroadcastManager . unregisterReceiver ( onFileDownloadedReceiver ) ; onFileDownloadedReceiver = new BroadcastReceiver ( ) { @ Override public void onReceive ( Context context , Intent intent ) { final int storedFileId = intent . getIntExtra ( storedFileEventKey , ( - 1 ) ) ; final List < IFile > files = activeFileDownloadsAdapter . getFiles ( ) ; for ( StoredFile storedFile : storedFiles ) { if ( ( storedFile . getId ( ) ) != storedFileId ) continue ; for ( IFile file : files ) { if ( ( file . getKey ( ) ) != ( storedFile . getServiceId ( ) ) ) continue ; activeFileDownloadsAdapter . remove ( file ) ; files . remove ( file ) ; break ; } break ; } } } ; localBroadcastManager . registerReceiver ( onFileDownloadedReceiver , new android . content . IntentFilter ( SyncService . onFileDownloadedEvent ) ) ; if ( ( onFileQueuedReceiver ) != null ) localBroadcastManager . unregisterReceiver ( onFileQueuedReceiver ) ; onFileQueuedReceiver = new BroadcastReceiver ( ) { @ Override public void onReceive ( Context context , Intent intent ) { final int storedFileId = intent . getIntExtra ( storedFileEventKey , ( - 1 ) ) ; if ( storedFileId == ( - 1 ) ) return ; storedFileAccess . getStoredFile ( storedFileId , new com . vedsoft . futures . runnables . TwoParameterRunnable < FluentTask < Void , Void , StoredFile > , StoredFile > ( ) { @ Override public void run ( FluentTask < Void , Void , StoredFile > owner , StoredFile storedFile ) { if ( storedFile != null ) activeFileDownloadsAdapter . add ( new com . lasthopesoftware . bluewater . servers . library . items . media . files . File ( SessionConnection . getSessionConnectionProvider ( ) , storedFile . getServiceId ( ) ) ) ; } } ) ; } } ; localBroadcastManager . registerReceiver ( onFileQueuedReceiver , new android . content . IntentFilter ( SyncService . onFileQueuedEvent ) ) ; listView . setAdapter ( activeFileDownloadsAdapter ) ; progressBar . setVisibility ( INVISIBLE ) ; listView . setVisibility ( VISIBLE ) ; } } ) ; } } ) ; final Button toggleSyncButton = ( ( Button ) ( viewFileslayout . findViewById ( toggleSyncButton ) ) ) ; final CharSequence startSyncLabel = getActivity ( ) . getText ( start_sync_button ) ; final CharSequence stopSyncLabel = getActivity ( ) . getText ( stop_sync_button ) ; <START_BUG> toggleSyncButton . setText ( ( SyncService . isSyncRunning ( ) ? startSyncLabel : stopSyncLabel ) ) ; <END_BUG> localBroadcastManager . registerReceiver ( new BroadcastReceiver ( ) { @ Override public void onReceive ( Context context , Intent intent ) { toggleSyncButton . setText ( stopSyncLabel ) ; } } , new android . content . IntentFilter ( SyncService . onSyncStartEvent ) ) ; localBroadcastManager . registerReceiver ( new BroadcastReceiver ( ) { @ Override public void onReceive ( Context context , Intent intent ) { toggleSyncButton . setText ( startSyncLabel ) ; } } , new android . content . IntentFilter ( SyncService . onSyncStopEvent ) ) ; toggleSyncButton . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { if ( SyncService . isSyncRunning ( ) ) SyncService . cancelSync ( v . getContext ( ) ) ; else SyncService . doSync ( v . getContext ( ) ) ; } } ) ; toggleSyncButton . setEnabled ( true ) ; return viewFileslayout ; } @ Override public void onDestroy ( ) { } }

Fix:
toggleSyncButton . setText ( ( ! ( SyncService . isSyncRunning ( ) ) ? startSyncLabel : stopSyncLabel ) ) ;