Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.location.LocationListener;
import android.location.LocationManager;

public class Main {
    /** A reference to the system Location Manager. */
    private static LocationManager mLocationManager;
    /** A listener that responds to location updates. */
    private static LocationListener mLocationListener;

    /** Deactivates GPS. Stops listening for location updates. */
    public static void deactivateGps() {
        try {
            if (mLocationListener != null) {
                mLocationManager.removeUpdates(mLocationListener);
                mLocationListener = null;
            }
        } catch (IllegalArgumentException e) {
            // ERROR: Intent is null.
            e.printStackTrace();
        }
    }
}