Edit:
You send a HashMap<String,String> as an extra when you click on a list item.
You should get an additional HashMap, and then get information about it. like this
HashMap<String,String> items=new HashMap<String,String>(); if (getIntent().getSerializableExtra("item") != null) items = (HashMap<String, String>) getIntent().getSerializableExtra("item"); String title = items.get(KEY_TITLE); String description = items.get(KEY_DESCRIPTION); String thumb_url = items.get(KEY_THUMB_URL); String cost = items.get(KEY_COST); String total =items.get(KEY_TOTAL);
this
itemamount = Double.parseDouble(text_cost_code.getText().toString());
throws an Exception because either text_cost_code.getText().toString() not Number , or it is empty
You need to make sure that it contains Number and is not empty.
then put this code in try catch , if Excluded is caught, then change the value to 0
try{ itemamount = Double.parseDouble(text_cost_code.getText().toString().trim()); } catch(NumberFormatException e) { itemamount=0; }
source share