强文
任何人都可以告诉我为什么我的记录会在Android Spinner中选择的每个项目上重复..
OnCreate()方法
path_spinner = (Spinner) findViewById(R.id.spinner_path);
path_spinner.post(new Runnable() {
@Override
public void run() {
path_spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (path_spinner.getSelectedItemPosition() > 0) {
getitemno = path_spinner.getSelectedItemPosition();
getposition = getitemno;
new AlgoApiNetCheck().execute();
if (path_spinner!=null && path_spinner.getSelectedItemPosition()==0)
{
new AlgoApiNetCheck().execute();
}
Log.d("Item Position", String.valueOf(getitemno));
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
});
Async Class OnPostMethod
if (!check) {
adapter = new ArrayAdapter<String>(MapLocationActivity.this,
android.R.layout.simple_spinner_item, get_path);
Log.d("Counter", get_path.toString());
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
path_spinner.setAdapter(adapter);
}
如何阻止我的微调器停止复制我的记录
答案 0 :(得分:0)
清除以下代码中的get_path列表数据
if (!check) {
adapter = new ArrayAdapter<String>(MapLocationActivity.this,
android.R.layout.simple_spinner_item, get_path);
Log.d("Counter", get_path.toString());
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
path_spinner.setAdapter(adapter);
}