【发布时间】:2015-06-05 07:05:35
【问题描述】:
谁能告诉我如何从 ArrayList 获取 int 值?
try {
getitemno = Integer.parseInt(arr.get(index));
getid = getitemno;
new AllRoutesDetails().execute();
Log.d("id", String.valueOf(getid));
}
catch (NumberFormatException e) {
e.printStackTrace();
}
数组数据
"[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"
【问题讨论】:
-
告诉我们
arr是如何在你的代码中声明的 -
发布更多细节,更多代码,logcat.... 一些东西。
-
使用:
.indexOf()喜欢:(yourarraylist).indexOf(); -
显示完整代码,只取整数类型的arraylist,因此不需要将其转换为整数,您可以直接获得整数值。
-
能否请您出示您对数组列表 arr 的声明