NumberFormatException in GPS processing
<p>I am having a weird problem.</p>

<p>I am developing a program to log GPS and sensor readings periodically. My friend runs the code on his machine using Eclipse Galileo 3.6 and it works perfectly fine for her. </p>

<p>When I run the code on my machine which has Eclipse Galileo 3.5.2 it shows service stopped unexpectedly. </p>

<p>We have the same JDK version. I am not able to figure out what may be the exact problem.</p>

<p>Please let me know what else information I need to give in order to fix the problem.</p>

<p>logcat</p>

<pre><code>    I/ActivityManager( 1104): Start proc com.sensor.test for service com.sensor.test/.SensorReadings: pid=3539 uid=10057 gids={3003, 1015}
D/AndroidRuntime( 3539): Shutting down VM
W/dalvikvm( 3539): threadid=1: thread exiting with uncaught exception (group=0x4001d7e0)
E/AndroidRuntime( 3539): FATAL EXCEPTION: main
E/AndroidRuntime( 3539): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.BATTERY_CHANGED flg=0x60000000 (has extras) } in com.sensor.test.SensorReadings$2@44770958
E/AndroidRuntime( 3539):    at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:905)
E/AndroidRuntime( 3539):    at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 3539):    at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 3539):    at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 3539):    at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 3539):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3539):    at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 3539):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 3539):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 3539):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 3539): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 3539):    at com.sensor.test.SensorReadings$2.onReceive(SensorReadings.java:327)
E/AndroidRuntime( 3539):    at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:892)
E/AndroidRuntime( 3539):    ... 9 more
W/ActivityManager( 1104): Activity destroy timeout for HistoryRecord{44b38508 com.sensor.test/.MainScreen}
D/WifiService( 1104): acquireWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder@44963d80}
D/LocationMasfClient( 1104): getNetworkLocation(): Location not found in cache, making network request
D/LocationMasfClient( 1104): getNetworkLocation(): Number of prefetched entries 10
E/LocationMasfClient( 1104): getNetworkLocation(): Returning *server* computed location with accuracy 28
D/libgps  ( 1104): GpsInterface_inject_location( 35.772249, -78.673950, 28.000 )
D/WifiService( 1104): releaseWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder@44963d80}
D/WifiService( 1104): acquireWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder@44963d80}
D/WifiService( 1104): releaseWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder@44963d80}
D/NativeCrypto( 1104): Freeing OpenSSL session
D/dalvikvm( 1104): GC_FOR_MALLOC freed 22104 objects / 1169312 bytes in 128ms
D/NativeCrypto( 1104): Freeing OpenSSL session
I/Process ( 3539): Sending signal. PID: 3539 SIG: 9
W/InputManagerService( 1104): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44b40dd0
I/ActivityManager( 1104): Process com.sensor.test (pid 3539) has died.
</code></pre>

<p>The pertinent code for line 88 with parsing going on:</p>

<pre><code>public void startService(){
        //startService(new Intent(MainScreen.this,SensorReadings.class));
        Intent intent = new Intent(MainScreen.this, SensorReadings.class);
        **intent.putExtra("lp", Integer.parseInt(""+longPeriod.getText()));// LINE 88**
        intent.putExtra("gp", Integer.parseInt(""+gpsPeriod.getText()));
        intent.putExtra("sp", Integer.parseInt(""+snrPeriod.getText()));
        //startActivity(intent);
        startService(intent);
    }
</code></pre>

<p>Thanks.
AG</p>
