gpt4 book ai didi

android - 如何在微调器中将特定位置设置为默认位置?

转载 作者:行者123 更新时间:2023-11-29 16:29:04 25 4
gpt4 key购买 nike

我正在从服务器获取数据列表并通过 setAdapter 在微调器中进行设置,但是第 3 个位置的数据是什么我想将其设置为默认值(第 0 个位置)。前任。 {芒果、香蕉、苹果};在旋转器中苹果应该是默认的而不是芒果

         else if 
(mListener.getSelection().get(0).
getGenLovs().get(i).getLovId().
equalsIgnoreCase(File_Key.AB_CUST_TITLE))
{
binding.spinTitle.setAdapter(new
GenLovsSpinner(getContext(),
mListener.getSelection().get(0).
getGenLovs().get(i).getValDes()));
}

我试过了

             String cls= 
String.valueOf(mListener.getSelection().
get(0).getGenLovs().get(i).getValDes().get(3));
binding.spinTitle.setSelection(Integer.parseInt(cls),true);

在这里,当我使用上面的代码时,我得到了 NumberFormatException

最佳答案

binding.spinTitle.setSelection(Integer.parseInt(cls),true);

使用上面这行的 insted

binding.spinTitle.setSelection(Integer.valueOf(cls));

关于android - 如何在微调器中将特定位置设置为默认位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57720614/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com