Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid: java.lang.NumberFormatException
    text
    copied!<p>One of my users has reported an error, this is the stack trace:</p> <pre><code>java.lang.RuntimeException: Unable to start service com.metatroid.minimal.weather.MinimalWeatherService@3082c088 with Intent { act=update dat=minimalweather://widget/id/295#update295 cmp=com.metatroid.minimal.weather/.MinimalWeatherService (has extras) }: java.lang.NumberFormatException: at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3063) at android.app.ActivityThread.access$3600(ActivityThread.java:125) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2096) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4627) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NumberFormatException: at org.apache.harmony.luni.util.FloatingPointParser.parseFloat(FloatingPointParser.java:305) at java.lang.Float.parseFloat(Float.java:291) at java.lang.Float.valueOf(Float.java:330) at com.metatroid.minimal.weather.MinimalWeatherService.onStartCommand(MinimalWeatherService.java:104) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3053) </code></pre> <p>Line 104 is <code>remoteView.setFloat(R.id.dateText, "setTextSize", Float.valueOf(dst.trim()).floatValue());</code></p> <p>Where 'dst' is </p> <pre><code>SharedPreferences prefs = getApplicationContext().getSharedPreferences("prefs", 0); String dst = prefs.getString("dsize", "10"); </code></pre> <p>Which is set from a configure activity with:</p> <pre><code>SharedPreferences prefs = self.getSharedPreferences("prefs", 0); SharedPreferences.Editor edit = prefs.edit(); EditText ds = (EditText) findViewById(R.id.dateSize); String dsv = ds.getText().toString().trim(); edit.putString("dsize", dsv); edit.commit(); finish(); </code></pre> <p>And R.id.dateSize refers to:</p> <pre><code>&lt;EditText android:id="@+id/dateSize" android:layout_width="fill_parent" android:layout_height="wrap_content" android:numeric="decimal" android:maxLength="2"/&gt; </code></pre> <p>I don't see how the user was able to input anything other than a decimal, or how this error might happen. Any ideas? Is there something wrong with the above code?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload