i am getting exceptiion like below
<pre><code>LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); 
                    Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
                     double longitude = location.getLongitude();
                     double latitude = location.getLatitude();


                if(location == null){
                   longitude = 0.0;
                   latitude = 0.0;
                   Log.i("CURRENT LONGITUDE", ""+longitude);
                   Log.i("CURRENT LATITUDE", ""+latitude);
                }

                Log.i("CURRENT LONGITUDE", ""+longitude);
                Log.i("CURRENT LATITUDE", ""+latitude); 
</code></pre>

<p>I am getting  problem at line  "double longitude = location.getLongitude();" which is line 93 in MainActivity;</p>

<pre><code>03-18 16:52:26.928: ERROR/AndroidRuntime(9598): java.lang.NullPointerException
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at com.demo.parsing.MainActivity$1.onClick(MainActivity.java:93)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at android.view.View.performClick(View.java:2364)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at android.view.View.onTouchEvent(View.java:4179)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at android.widget.TextView.onTouchEvent(TextView.java:6540)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at android.view.View.dispatchTouchEvent(View.java:3709)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at android.os.Looper.loop(Looper.java:123)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at android.app.ActivityThread.main(ActivityThread.java:4363)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at java.lang.reflect.Method.invokeNative(Native Method)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at java.lang.reflect.Method.invoke(Method.java:521)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-18 16:52:26.928: ERROR/AndroidRuntime(9598):     at dalvik.system.NativeStart.main(Native Method)
</code></pre>
