2 qingcheng11 QingCheng11 于 2014.11.29 17:07 提问

autocompletetextview的问题

private List normalString ;
private TextView show;
private MultiAutoCompleteTextView multiAutoCompleteTextView;
private Button clean;
private ArrayAdapter arrayAdapter;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home_activity_layout);
mp3Infos = MediaUtil.getMp3Infos(HomeActivity.this); // 获取歌曲对象集合
//System.out.println(mp3Infos.size());
//System.out.println(mp3Infos.get(1).getDisplayName());

int s = mp3Infos.size();
System.out.println(s);
normalString = new ArrayList();
for (int i = 0; i < s; i++) {

    String name = mp3Infos.get(i).getTitle();
    normalString.add(name);

//System.out.println(name);
//System.out.println(i);

}
//

// setListAdpter(MediaUtil.getMusicMaps(mp3Infos)); //显示歌曲列表

multiAutoCompleteTextView = (MultiAutoCompleteTextView) findViewById(R.id.autoComplete);

arrayAdapter = new ArrayAdapter(this,
R.layout.auto_complete_list, normalString);
multiAutoCompleteTextView.setAdapter(arrayAdapter);
multiAutoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());

multiAutoCompleteTextView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
// TODO Auto-generated method stub
//这需要获取对应的normalString中的position而不是在multiAutoCompleteTextView中的position
listPosition = position; // 获取列表点击的位置
playMusic(listPosition);
}

});

normalString中存储的是需要搜索的list集合,autocompletetextview中点击item后,不是获取autocompletetextview输入字符后的list列表的position,获取其对应的normalString中的第几个怎么获取啊

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!