Quantcast
Channel: how to clear spinner value in android - Stack Overflow
Viewing all articles
Browse latest Browse all 4

how to clear spinner value in android

$
0
0

i have two spinners when i select items(other then first item) in first spinner which is saved in array it populates data in spinner second which comes from web services. i want that when i again select first data which is title of spinner first it should clear all the value from spinner second. i did all tricks but helpless. suggest me.

my code is:

  if(spinner1== 0) {
        spinner2List.clear();
        ArrayAdapter<String> adapterEmpty = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, spinner2List);
        adapterEmpty.setDropDownViewResource(R.layout.spinner_layout);

        // Apply the adapter to the spinner
        spinner2.setAdapter(adapterEmpty);
    }

thanks.


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>