我正在编写一个购物车应用程序,我需要在其中打开一个活动中的特定项目,该项目已被用户在列表视图中单击。
我正在使用两个不同的活动,一个是在列表视图中显示选定的项目,即CartActivity.java,第二个是在另一个活动中显示任何选定的项目,即ProductInformationActivity.java
我已经编写了代码来调用用户选择的活动中的特定项目,在CartActivity.java的列表视图中
// below is the line number 77
itemamount = Double.parseDouble(text_cost_code.getText().toString());
Logcat 说:
04-30 14:37:10.073: E/AndroidRuntime(273): FATAL EXCEPTION: main
04-30 14:37:10.073: E/AndroidRuntime(273): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.era.restaurant.versionoct/com.era.restaurant.versionoct.menu.ProductInformationActivity}: java.lang.NumberFormatException:
04-30 14:37:10.073: E/AndroidRuntime(273): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-30 14:37:10.073: E/AndroidRuntime(273): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-30 14:37:10.073: E/AndroidRuntime(273): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-30 14:37:10.073: E/AndroidRuntime(273): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-30 14:37:10.073: E/AndroidRuntime(273): at android.os.Handler.dispatchMessage(Handler.java:99)
04-30 14:37:10.073: E/AndroidRuntime(273): at android.os.Looper.loop(Looper.java:123)
04-30 14:37:10.073: E/AndroidRuntime(273): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-30 14:37:10.073: E/AndroidRuntime(273): at java.lang.reflect.Method.invokeNative(Native Method)
04-30 14:37:10.073: E/AndroidRuntime(273): at java.lang.reflect.Method.invoke(Method.java:521)
04-30 14:37:10.073: E/AndroidRuntime(273): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-30 14:37:10.073: E/AndroidRuntime(273): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-30 14:37:10.073: E/AndroidRuntime(273): at dalvik.system.NativeStart.main(Native Method)
04-30 14:37:10.073: E/AndroidRuntime(273): Caused by: java.lang.NumberFormatException:
04-30 14:37:10.073: E/AndroidRuntime(273): at org.apache.harmony.luni.util.FloatingPointParser.parseDouble(FloatingPointParser.java:267)
04-30 14:37:10.073: E/AndroidRuntime(273): at java.lang.Double.parseDouble(Double.java:287)
04-30 14:37:10.073: E/AndroidRuntime(273): at com.era.restaurant.versionoct.menu.ProductInformationActivity.onCreate(ProductInformationActivity.java:77)
04-30 14:37:10.073: E/AndroidRuntime(273): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-30 14:37:10.073: E/AndroidRuntime(273): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-30 14:37:10.073: E/AndroidRuntime(273): ... 11 more