bitQuit_Android/app/src/main/java/com/tonydicola/bletest/app/MainActivity.java
@Override
    protected void onResume() {
        super.onResume();

        // Get previous state of bitQuit -- saved in sharedPreferences
        SharedPreferences data = getSharedPreferences("bitQuit_state", Context.MODE_PRIVATE);
        numCigs = data.getInt("Count", 0);
        thisMonth = data.getInt("thisMonth", 50);

        // Write to countDisplay
        countDisplay.setText("# Cigarettes: " + Integer.toString(numCigs));
        countDisplay.invalidate();

        timeDisplay.setText("bitQuit is Unlocked");
        timeDisplay.invalidate();

        // Scan for all BTLE devices.
        // The first one with the UART service will be chosen--see the code in the scanCallback.
        adapter.startLeScan(scanCallback);
    }
// OnResume, called right before UI is displayed.  Start the BTLE connection.
OnResume, called right before UI is displayed.  Start the BTLE connection.
OnResume called right before UI is displayed . Start the BTLE connection .
@Override
    protected void onResume() {
        super.onResume();
        SharedPreferences data = getSharedPreferences("bitQuit_state", Context.MODE_PRIVATE);
        numCigs = data.getInt("Count", 0);
        thisMonth = data.getInt("thisMonth", 50);
        countDisplay.setText("# Cigarettes: " + Integer.toString(numCigs));
        countDisplay.invalidate();
        timeDisplay.setText("bitQuit is Unlocked");
        timeDisplay.invalidate();
        adapter.startLeScan(scanCallback);
    }
@ Override protected void onResume ( ) { super . onResume ( ) ; SharedPreferences data = getSharedPreferences ( "bitQuit_state" , Context . MODE_PRIVATE ) ; numCigs = data . getInt ( "Count" , 0 ) ; thisMonth = data . getInt ( "thisMonth" , 50 ) ; countDisplay . setText ( "# Cigarettes: " + Integer . toString ( numCigs ) ) ; countDisplay . invalidate ( ) ; timeDisplay . setText ( "bitQuit is Unlocked" ) ; timeDisplay . invalidate ( ) ; adapter . startLeScan ( scanCallback ) ; }
OnResume, called right before UI is displayed.
OnResume called right before UI is displayed .
// Get previous state of bitQuit -- saved in sharedPreferences // Write to countDisplay // Scan for all BTLE devices. // The first one with the UART service will be chosen--see the code in the scanCallback.