我想将此值与值进行比较,以在微调器执行编辑操作中填充所选值。我无法做同样的事情,因为我没有比较我的价值。我也在下面粘贴了logcat的详细信息。请检查并查看此内容。
For循环:
for (int n = 0; n < subMaterialTypeModelArrayList.size (); n++) {
Log.i ("Test","msg: "+subMaterialTypeModelArrayList.get (n).getId ());
try {
Log.i ("Test","id:"+subid);
} catch (NumberFormatException e){
}
Logcat结果:
03-01 11:44:40.402 4113-4113 / com.example.jjjj.dashboard I / Test:msg:1 03-01 11:46:46.284 4113-4113 / com.example.jjjj.dashboard I / Test:subid :[ “1”, “2”]
答案 0 :(得分:0)
Try this way,
if (subMaterialTypeModelArrayList != null && !subMaterialTypeModelArrayList.equals("")) {
for (int n = 0; n < subMaterialTypeModelArrayList.size(); n++) {
if (subMaterialTypeModelArrayList.get(n).getId ().equalsIgnoreCase(subid)) {
spinner_name.setSelection(n);
}
}