ListView Item Row をクリックした ProductInformationActivity.java の特定の項目を開こうとするプログラムを作成していますが、Item Row をクリックするたびに残念ながら App has Stoppedが表示されます
エラー: 原因: java.lang.NumberFormatException: 無効な double: ""
CartAdapter.java:
public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View vi = convertView;
if (convertView == null)
vi = inflater.inflate(R.layout.listrow_cart, null);
vi.setClickable(true);
vi.setFocusable(true);
vi.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v)
{
HashMap<String, String> prod = Constants.mItem_Detail.get(position);
Intent mViewCartIntent = new Intent
(activity,com.era.restaurant.versionoct.menu.ProductInformationActivity.class);
mViewCartIntent.putExtra("product", prod);
activity.startActivity(mViewCartIntent);
}
});
Logcat は次のように述べています。
04-27 04:25:01.520: E/AndroidRuntime(1214): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.era.restaurant.versionoct/com.era.restaurant.versionoct.menu.ProductInformationActivity}: java.lang.NumberFormatException: Invalid double: ""
04-27 04:25:01.520: E/AndroidRuntime(1214): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
04-27 04:25:01.520: E/AndroidRuntime(1214): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
04-27 04:25:01.520: E/AndroidRuntime(1214): at android.app.ActivityThread.access$600(ActivityThread.java:141)
04-27 04:25:01.520: E/AndroidRuntime(1214): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
04-27 04:25:01.520: E/AndroidRuntime(1214): at android.os.Handler.dispatchMessage(Handler.java:99)
04-27 04:25:01.520: E/AndroidRuntime(1214): at android.os.Looper.loop(Looper.java:137)
04-27 04:25:01.520: E/AndroidRuntime(1214): at android.app.ActivityThread.main(ActivityThread.java:5041)
04-27 04:25:01.520: E/AndroidRuntime(1214): at java.lang.reflect.Method.invokeNative(Native Method)
04-27 04:25:01.520: E/AndroidRuntime(1214): at java.lang.reflect.Method.invoke(Method.java:511)
04-27 04:25:01.520: E/AndroidRuntime(1214): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-27 04:25:01.520: E/AndroidRuntime(1214): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-27 04:25:01.520: E/AndroidRuntime(1214): at dalvik.system.NativeStart.main(Native Method)
04-27 04:25:01.520: E/AndroidRuntime(1214): Caused by: java.lang.NumberFormatException: Invalid double: ""
04-27 04:25:01.520: E/AndroidRuntime(1214): at java.lang.StringToReal.invalidReal(StringToReal.java:63)
04-27 04:25:01.520: E/AndroidRuntime(1214): at java.lang.StringToReal.parseDouble(StringToReal.java:248)
04-27 04:25:01.520: E/AndroidRuntime(1214): at java.lang.Double.parseDouble(Double.java:295)
04-27 04:25:01.520: E/AndroidRuntime(1214): at com.era.restaurant.versionoct.menu.ProductInformationActivity.onCreate(ProductInformationActivity.java:77)
04-27 04:25:01.520: E/AndroidRuntime(1214): at android.app.Activity.performCreate(Activity.java:5104)
04-27 04:25:01.520: E/AndroidRuntime(1214): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
04-27 04:25:01.520: E/AndroidRuntime(1214): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
04-27 04:25:01.520: E/AndroidRuntime(1214): ... 11 more