我需要使用String的值在微调器上设置所选项。 目前我使用此功能(此处提示:Set selected item of spinner programmatically)。
Spinner nudSpinner = (Spinner)nud.findViewById(R.id.spinUnity);
EditText nudEText = (EditText)nud. findViewById(R.id.etxtUnityName);
nudSpinner.setSelection(((ArrayAdapter<String>)nudSpinner.getAdapter()).getPosition(unities.get(position).split(" ")[0]));
它工作正常,但它给了我以下警告:
Unchecked cast: 'android.widget.SpinnerAdapter' to 'android.widget.ArrayAdapter<java.lang.String>'
Signals places where an unchecked warning is issued by the compiler, for example:
void f(HashMap map) {
map.put("key", "value");
}
Hint: Pass -Xlint:unchecked to javac to get more details.
如何解决警告?
由于