Search in sources :

Example 1 with CurrencyUtils

use of com.eventyay.organizer.utils.CurrencyUtils in project open-event-orga-app by fossasia.

the class CountryPreferenceFragmentCompat method setUpSpinner.

private void setUpSpinner() {
    CurrencyUtils currencyUtils = new CurrencyUtils();
    Map<String, String> countryCurrencyMap = currencyUtils.getCountryCurrencyMap();
    List<String> countryList = new ArrayList<>(countryCurrencyMap.keySet());
    ArrayAdapter<CharSequence> paymentCountryAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item);
    paymentCountryAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    paymentCountryAdapter.addAll(countryList);
    countrySpinner.setAdapter(paymentCountryAdapter);
    countrySpinner.setSelection(savedIndex);
    countrySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            index = position;
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        // empty
        }
    });
}
Also used : ArrayList(java.util.ArrayList) View(android.view.View) AdapterView(android.widget.AdapterView) CurrencyUtils(com.eventyay.organizer.utils.CurrencyUtils) AdapterView(android.widget.AdapterView) ArrayAdapter(android.widget.ArrayAdapter)

Aggregations

View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ArrayAdapter (android.widget.ArrayAdapter)1 CurrencyUtils (com.eventyay.organizer.utils.CurrencyUtils)1 ArrayList (java.util.ArrayList)1