My LocationListener is null in Android
<p>In my app I am checking GPS strength. I get an <code>java.lang.IllegalArgumentException</code>:</p>

<pre><code>listener==null.
</code></pre>

<p>I did not assign code listener to be null, and I write the code in the <code>OnCreate()</code> method. I don't know why listener turns null. Where am I going wrong?</p>

<p>My code:</p>

<pre><code>public class Gps_strength extends Activity{
    private LocationManager mLocationManager;
    private LocationListener mGpsLocationListener;
    private GpsStatus.Listener gps_listener;

    public void onCreate(Bundle savedInstanceState) {
        mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, mGpsLocationListener);  // line no 31.
        mLocationManager.addGpsStatusListener(gps_listener);
        if (mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) == true) {
          ..... GPS strength checking coding..
        }
    }
}
</code></pre>

<p>Logcat:</p>

<pre><code>    06-03 13:04:30.695: ERROR/AndroidRuntime(2595): Caused by:     java.lang.IllegalArgumentException: listener==null
    06-03 13:04:30.695: ERROR/AndroidRuntime(2595):     at android.location.LocationManager.requestLocationUpdates(LocationManager.java:627)
    06-03 13:04:30.695: ERROR/AndroidRuntime(2595):     at com.gps.Gps_strength.onCreate(Gps_strength.java:31)
</code></pre>
