开发者

spinner adapter and Listview adapter

开发者 https://www.devze.com 2023-04-06 12:20 出处:网络
I have a ListActivity with a setListAdapter call so that I can dynamically hide buttons in the listview. This was working fine till I introduced a spinner which now works fine but somehow stops the li

I have a ListActivity with a setListAdapter call so that I can dynamically hide buttons in the listview. This was working fine till I introduced a spinner which now works fine but somehow stops the listview adapter from working without producing any debug issues or crashes so the开发者_StackOverflow社区 buttons are no longer being hidden where they should.

Has anyone come across this and resolved it before?

...oncreate() {
...

ArrayAdapter<CharSequence> spinadapter = ArrayAdapter.createFromResource(
            this, R.array.order_by_array, android.R.layout.simple_spinner_item);
    spinadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(spinadapter);
    spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());


}



private void updateData() {

...        
    MySimpleArrayAdapter adapter = new MySimpleArrayAdapter(this, mp3, titles, artists);
    setListAdapter(adapter);
}


I discovered what was happening here, there was no conflict, I just forgot to call the pertinent method after the spinner was selected.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号