GPS not working
<p>What I am doing is trying to get a basic GPS working and can't figure out the problem (there is no errors coming up). When i run it on the emulator it crashes. I am using android 2.2</p>

<pre><code>package Weather.app;


import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.Geocoder;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;


public class WeatherAppActivity extends Activity{
/** Called when the activity is first created. */
 private static final long MINIMUM_DISTANCE_CHANGE_FOR_UPDATES = 1; // in Meters
 private static final long MINIMUM_TIME_BETWEEN_UPDATES = 1000; // in Milliseconds


protected LocationManager locationManager;
protected LocationListener MyLocationListener;
protected Button findButton;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    findButton = (Button) findViewById(R.id.findButton);
    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    locationManager.requestLocationUpdates(
              locationManager.GPS_PROVIDER,
              MINIMUM_TIME_BETWEEN_UPDATES,
              MINIMUM_DISTANCE_CHANGE_FOR_UPDATES,
              (LocationListener) this
            );



    findButton.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        showCurrentLocation();
                    }
    });  
}

    protected void showCurrentLocation() {

                Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

                if (location != null) {
                    String message = String.format(
                            "Current Location \n Longitude: %1$s \n Latitude: %2$s",
                            location.getLongitude(), location.getLatitude()
                    );
                    Toast.makeText(WeatherAppActivity.this, message,
                            Toast.LENGTH_LONG).show();

                }

                final class MyLocationListener implements LocationListener {
                     @Override
                        public void onLocationChanged(Location location) {
                             String message = String.format(
                                 "New Location \n Longitude: %1$s \n Latitude: %2$s",
                             location.getLongitude(), location.getLatitude()
                              );
                              Toast.makeText(WeatherAppActivity.this, message, Toast.LENGTH_LONG).show();
                        }
                     @Override
                        public void onStatusChanged(String s, int i, Bundle b) {
                              Toast.makeText(WeatherAppActivity.this, "Provider status changed",
                                    Toast.LENGTH_LONG).show();
                            }
                     @Override
                        public void onProviderDisabled(String s) {
                            Toast.makeText(WeatherAppActivity.this,
                                  "Provider disabled by the user. GPS turned off",
                                      Toast.LENGTH_LONG).show();
                            }
                     @Override
                        public void onProviderEnabled(String s) {
                            Toast.makeText(WeatherAppActivity.this,
                                   "Provider enabled by the user. GPS turned on",
                                       Toast.LENGTH_LONG).show();
                          }

                }                           






}
</code></pre>

<p>}</p>

<p>This is also in my manifest:</p>

<pre><code>&lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
&lt;uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /&gt;
&lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
&lt;uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /&gt;
&lt;uses-permission android:name="android.permission.CONTROL_LOCATION_UPDATES" /&gt;
</code></pre>

<p>I have updated this code as I have made a few changes </p>
