开发者

How to change data on one spinner by onclick on another spinner in android?

开发者 https://www.devze.com 2023-04-03 13:53 出处:网络
all i have two spinners spinner1 & spinner2. in one spinner i am showing names from database.(Ex. onkar) now if i select onkar name on spinner1 then all names must be occurred on spinner2 except n

all i have two spinners spinner1 & spinner2. in one spinner i am showing names from database.(Ex. onkar) now if i select onkar name on spinner1 then all names must be occurred on spinner2 except name onkar. i want to do like this.but i am not getting how to achieve it? give me some sample or give idea for the same.

or can i change data开发者_如何转开发 of spinner dynamically???? Thanks in Advance--


consider that u have used two adapters to set data to spinner when u select first spinner just remove that value from second adapter and then call method notifyDataSetChanged() it will change second spinner data.


    @Override
public void onItemSelected(AdapterView<?> parent, View view, int position,
        long id) {
    // TODO Auto-generated method stub
    super.onItemSelected(parent, view, position, id);
    // Step 1: Remove Data from ArrayList 1
    // Step 2: Adpater for first spinner .notifiyDataSetChanged()  

}
0

精彩评论

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

关注公众号