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");
             
Connect your IDE to all the code out there  Get Codota for Java