I have done with code in Android:
List<String> spinnerArray = new ArrayList<String>();
for (int i = 0; i < items.size(); i++) {
LinkedTreeMap<String, String> item = (LinkedTreeMap) items.get(i);
// THIS LINE THROW EXCEPTION
double d = Double.parseDouble(item.get("id").toString());
locations.put(Integer.parseInt(item.get("id")), item.get("name"));
spinnerArray.add(item.get("name"));
}
I get the error when I define the "d" variable.
The strange thing is if I run the same line in the debug I get the double value I need.
UPDATE ANSWER
On the debug window I have:
items.get(i) = {LinkedTreeMap@5317} size = 5
0 = {LinkedTreeMap$Node@5378} "id" -> "1.0"
key = "id"
value = {Double@5384} "1.0"
toString(). Also, is it a double or an integer? You're parsing the ID twice