app/src/main/java/com/mohammadKZ/CoronaVirus_COVID19_statistics/fragments/CountryFragment.java
private void Spinner(List<Country> countries1) {
        //Creating the ArrayAdapter instance having the country list
        countriesName = new String[countries.size() - 1];
        int counter = 1;
        for (int i = 0; i < countries1.size() - 1; i++) {
            countriesName[i] = countries1.get(counter).getCountry();
            counter++;
        }

        ArrayAdapter aa = null;
        try {
            aa = new ArrayAdapter(getContext(), android.R.layout.simple_spinner_item, countriesName);
        } catch (Exception e) {
            e.getMessage();
        }
        if (aa != null)
            aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        //Setting the ArrayAdapter data on the Spinner
        spinner.setAdapter(aa);
    }
// set the spinner value ==> country name
set the spinner value ==> country name
set the spinner value == > country name
private void Spinner(List<Country> countries1) {
        countriesName = new String[countries.size() - 1];
        int counter = 1;
        for (int i = 0; i < countries1.size() - 1; i++) {
            countriesName[i] = countries1.get(counter).getCountry();
            counter++;
        }
        ArrayAdapter aa = null;
        try {
            aa = new ArrayAdapter(getContext(), android.R.layout.simple_spinner_item, countriesName);
        } catch (Exception e) {
            e.getMessage();
        }
        if (aa != null)
            aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(aa);
    }
private void Spinner ( List < Country > countries1 ) { countriesName = new String [ countries . size ( ) - 1 ] ; int counter = 1 ; for ( int i = 0 ; i < countries1 . size ( ) - 1 ; i ++ ) { countriesName [ i ] = countries1 . get ( counter ) . getCountry ( ) ; counter ++ ; } ArrayAdapter aa = null ; try { aa = new ArrayAdapter ( getContext ( ) , android . R . layout . simple_spinner_item , countriesName ) ; } catch ( Exception e ) { e . getMessage ( ) ; } if ( aa != null ) aa . setDropDownViewResource ( android . R . layout . simple_spinner_dropdown_item ) ; spinner . setAdapter ( aa ) ; }
set the spinner value ==> country name
set the spinner value == > country name
//Creating the ArrayAdapter instance having the country list //Setting the ArrayAdapter data on the Spinner