Code example for Handler

Methods: removeCallbacksAndMessages

0
        handler.postDelayed(getData, 10000);
    } 
 
    public void stopTracking() { 
        mLocationManager.removeUpdates(this);
        handler.removeCallbacksAndMessages(null);
    } 
 
    public void startTracking() { 
        final boolean gpsEnabled = mLocationManager
                .isProviderEnabled(LocationManager.GPS_PROVIDER);
        final boolean networkEnabled = mLocationManager
                .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
         
        SharedPreferences preferences = PreferenceManager
                .getDefaultSharedPreferences(this);
 
        if (!mFirstTrack && gpsEnabled) {
            Log.i(TAG, "Tracking by GPS");
             
Stop searching for code, let great code find you!  Add Codota to your java IDE