List of usage examples for android.widget ArrayAdapter setDropDownViewResource
public void setDropDownViewResource(@LayoutRes int resource)
Sets the layout resource to create the drop down views.
From source file:com.mifos.mifosxdroid.online.GroupLoanAccountFragment.java
private void inflateFrequencyPeriodSpinner() { showProgress(true);/*from w w w. j ava2 s.c o m*/ App.apiManager.getGroupLoansAccountTemplate(groupId, productId, new Callback<Response>() { @Override public void success(final Response result, Response response) { /* Activity is null - Fragment has been detached; no need to do anything. */ if (getActivity() == null) return; Log.d(LOG_TAG, ""); final List<TermFrequencyTypeOptions> termFrequencyType = new ArrayList<>(); // you can use this array to populate your spinner final ArrayList<String> termFrequencyTypeNames = new ArrayList<String>(); //Try to get response body BufferedReader reader = null; StringBuilder sb = new StringBuilder(); try { reader = new BufferedReader(new InputStreamReader(result.getBody().in())); String line; while ((line = reader.readLine()) != null) { sb.append(line); } JSONObject obj = new JSONObject(sb.toString()); if (obj.has("termFrequencyTypeOptions")) { JSONArray termFrequencyTypes = obj.getJSONArray("termFrequencyTypeOptions"); for (int i = 0; i < termFrequencyTypes.length(); i++) { JSONObject termFrequencyTypeObject = termFrequencyTypes.getJSONObject(i); TermFrequencyTypeOptions termFrequency = new TermFrequencyTypeOptions(); termFrequency.setId(termFrequencyTypeObject.optInt("id")); termFrequency.setValue(termFrequencyTypeObject.optString("value")); termFrequencyType.add(termFrequency); termFrequencyTypeNames.add(termFrequencyTypeObject.optString("value")); termFrequencyTypeIdHashMap.put(termFrequency.getValue(), termFrequency.getId()); } } String stringResult = sb.toString(); } catch (Exception e) { Log.e(LOG_TAG, "", e); } final ArrayAdapter<String> termFrequencyTypeAdapter = new ArrayAdapter<>(getActivity(), layout.simple_spinner_item, termFrequencyTypeNames); termFrequencyTypeAdapter.setDropDownViewResource(layout.simple_spinner_dropdown_item); sp_payment_periods.setAdapter(termFrequencyTypeAdapter); sp_payment_periods.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { loanTermFrequency = termFrequencyTypeIdHashMap.get(termFrequencyTypeNames.get(i)); Log.d("termFrequencyTypeId" + termFrequencyTypeNames.get(i), String.valueOf(loanTermFrequency)); if (loanTermFrequency != -1) { } else { Toast.makeText(getActivity(), getString(R.string.error_select_fund), Toast.LENGTH_SHORT) .show(); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); showProgress(false); } @Override public void failure(RetrofitError retrofitError) { Log.d(LOG_TAG, retrofitError.getLocalizedMessage()); showProgress(false); } }); }
From source file:donations.DonationsFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); /* Flattr *//*from w w w. ja va 2 s.co m*/ if (mFlattrEnabled) { // inflate flattr view into stub ViewStub flattrViewStub = (ViewStub) getActivity().findViewById(R.id.donations__flattr_stub); flattrViewStub.inflate(); buildFlattrView(); } /* Google */ if (mGoogleEnabled) { // inflate google view into stub ViewStub googleViewStub = (ViewStub) getActivity().findViewById(R.id.donations__google_stub); googleViewStub.inflate(); // choose donation amount mGoogleSpinner = (Spinner) getActivity().findViewById(R.id.donations__google_android_market_spinner); ArrayAdapter<CharSequence> adapter; if (mDebug) { adapter = new ArrayAdapter<CharSequence>(getActivity(), android.R.layout.simple_spinner_item, CATALOG_DEBUG); } else { adapter = new ArrayAdapter<CharSequence>(getActivity(), android.R.layout.simple_spinner_item, mGoogleCatalogValues); } adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mGoogleSpinner.setAdapter(adapter); Button btGoogle = (Button) getActivity() .findViewById(R.id.donations__google_android_market_donate_button); btGoogle.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { donateGoogleOnClick(v); } }); // Create the helper, passing it our context and the public key to verify signatures with if (mDebug) Log.d(TAG, "Creating IAB helper."); mHelper = new IabHelper(getActivity(), mGooglePubkey); // enable debug logging (for a production application, you should set this to false). mHelper.enableDebugLogging(mDebug); // Start setup. This is asynchronous and the specified listener // will be called once setup completes. if (mDebug) Log.d(TAG, "Starting setup."); mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { public void onIabSetupFinished(IabResult result) { if (mDebug) Log.d(TAG, "Setup finished."); if (!result.isSuccess()) { // Oh noes, there was a problem. openDialog(android.R.drawable.ic_dialog_alert, R.string.donations__google_android_market_not_supported_title, getString(R.string.donations__google_android_market_not_supported)); return; } // Have we been disposed of in the meantime? If so, quit. if (mHelper == null) return; } }); } /* PayPal */ if (mPaypalEnabled) { // inflate paypal view into stub ViewStub paypalViewStub = (ViewStub) getActivity().findViewById(R.id.donations__paypal_stub); paypalViewStub.inflate(); Button btPayPal = (Button) getActivity().findViewById(R.id.donations__paypal_donate_button); btPayPal.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { donatePayPalOnClick(v); } }); } }
From source file:blackman.matt.boardlist.BoardListActivity.java
/** * Sets up the spinners on the view.//from w w w . j a v a 2 s . c o m */ private void initSpinners() { Spinner spinnerSort; Spinner spinnerOrder; ArrayAdapter<CharSequence> sortAdapter; ArrayAdapter<CharSequence> orderAdapter; // Set up the spinners spinnerSort = (Spinner) findViewById(R.id.spinner_sort_by); spinnerOrder = (Spinner) findViewById(R.id.spinner_sort_order); sortAdapter = ArrayAdapter.createFromResource(this, R.array.sql_columns_array, android.R.layout.simple_spinner_item); orderAdapter = ArrayAdapter.createFromResource(this, R.array.sql_sort_order_array, android.R.layout.simple_spinner_item); sortAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); orderAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinnerSort.setAdapter(sortAdapter); spinnerOrder.setAdapter(orderAdapter); spinnerOrder.setOnItemSelectedListener(new SpinnerActivity()); spinnerSort.setOnItemSelectedListener(new SpinnerActivity()); }
From source file:net.reichholf.dreamdroid.fragment.TimerEditFragment.java
/** * Set the GUI-Content from <code>mTimer</code> *///from w w w . j av a 2 s .c o m protected void reload() { // Name mName.setText(mTimer.getString(Timer.KEY_NAME)); mName.setHint(R.string.title); // Description mDescription.setText(mTimer.getString(Timer.KEY_DESCRIPTION)); mDescription.setHint(R.string.description); // Enabled int disabled = DateTime.parseTimestamp(mTimer.getString(Timer.KEY_DISABLED)); if (disabled == 0) { mEnabled.setChecked(true); } else { mEnabled.setChecked(false); } int zap = DateTime.parseTimestamp(mTimer.getString(Timer.KEY_JUST_PLAY)); if (zap == 1) { mZap.setChecked(true); } else { mZap.setChecked(false); } mService.setText(mTimer.getString(Timer.KEY_SERVICE_NAME)); // Afterevents ArrayAdapter<CharSequence> aaAfterevent = ArrayAdapter.createFromResource(getAppCompatActivity(), R.array.afterevents, android.R.layout.simple_spinner_item); aaAfterevent.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mAfterevent.setAdapter(aaAfterevent); int aeValue = DateTime.parseTimestamp(mTimer.getString(Timer.KEY_AFTER_EVENT)); mAfterevent.setSelection(aeValue); // Locations ArrayAdapter<String> aaLocations = new ArrayAdapter<>(getAppCompatActivity(), android.R.layout.simple_spinner_item, DreamDroid.getLocations()); aaLocations.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mLocation.setAdapter(aaLocations); String timerLoc = mTimer.getString(Timer.KEY_LOCATION); for (int i = 0; i < DreamDroid.getLocations().size(); i++) { String loc = DreamDroid.getLocations().get(i); if (timerLoc != null) { if (timerLoc.equals(loc)) { mLocation.setSelection(i); } } } // Start and Endtime mBegin = DateTime.parseTimestamp(mTimer.getString(Timer.KEY_BEGIN)); mEnd = DateTime.parseTimestamp(mTimer.getString(Timer.KEY_END)); Date dateBegin = new Date(((long) mBegin) * 1000); Date dateEnd = new Date(((long) mEnd) * 1000); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm"); mStartDate.setText(dateFormat.format(dateBegin)); mStartTime.setText(timeFormat.format(dateBegin)); mEndDate.setText(dateFormat.format(dateEnd)); mEndTime.setText(timeFormat.format(dateEnd)); // Repeatings int repeatedValue = 0; try { repeatedValue = DateTime.parseTimestamp(mTimer.getString(Timer.KEY_REPEATED)); } catch (NumberFormatException ex) { } String repeatedText = getRepeated(repeatedValue); mRepeatings.setText(repeatedText); String text = mTimer.getString(Timer.KEY_TAGS); if (text == null) { text = ""; } mTags.setText(text); String[] tags = text.split(" "); Collections.addAll(mSelectedTags, tags); }
From source file:de.uni_koblenz_landau.apow.ObsDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.obs_detail_fragment, container, false); // Create UI references. mDeleteDialog = (DeleteDialogFragment) getFragmentManager().findFragmentByTag(DELETE_DIALOG_ID); if (mDeleteDialog != null) { mDeleteDialog.setListener(this); }/*from w w w. j av a2s . co m*/ mClassLayout = (LinearLayout) view.findViewById(R.id.obs_detail_class); mClassSpinner = (Spinner) view.findViewById(R.id.obs_detail_class_spinner); mClassSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View v, int pos, long id) { mQuestionLayout.setVisibility(View.GONE); mTestLayout.setVisibility(View.GONE); mFindingLayout.setVisibility(View.GONE); mSymptomLayout.setVisibility(View.GONE); switch (pos) { case Constants.CLASS_QUESTION: mQuestionLayout.setVisibility(View.VISIBLE); break; case Constants.CLASS_TEST: mTestLayout.setVisibility(View.VISIBLE); break; case Constants.CLASS_FINDING: mFindingLayout.setVisibility(View.VISIBLE); break; case Constants.CLASS_SYMPTOM: mSymptomLayout.setVisibility(View.VISIBLE); break; } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); mQuestionLayout = (LinearLayout) view.findViewById(R.id.obs_detail_question); mQuestionTextView = (EditText) view.findViewById(R.id.obs_detail_question_text); mTestLayout = (LinearLayout) view.findViewById(R.id.obs_detail_test); mTestConceptView = (Spinner) view.findViewById(R.id.obs_detail_test_concept); mTestConceptView.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View v, int pos, long id) { ListViewItem item = (ListViewItem) parent.getItemAtPosition(pos); mTestUnitView.setText(item.getField2()); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); mTestUnitView = (TextView) view.findViewById(R.id.obs_detail_test_unit); mTestValueView = (EditText) view.findViewById(R.id.obs_detail_test_value); mFindingLayout = (LinearLayout) view.findViewById(R.id.obs_detail_finding); mFindingValueCodedView = (AutoCompleteTextView) view.findViewById(R.id.obs_detail_finding_value_coded); mFindingValueCodedView.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable s) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (!findingCodeBlock) { findingCode = -1; } findingCodeBlock = false; searchFindings(s.toString().trim()); } }); mFindingValueCodedView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> listView, View view, int position, long id) { findingCode = (int) id; } }); mFindingCertaintyView = (CheckBox) view.findViewById(R.id.obs_detail_finding_certainty); mFindingSeverityCodedView = (CheckBox) view.findViewById(R.id.obs_detail_finding_severity_coded); mSymptomLayout = (LinearLayout) view.findViewById(R.id.obs_detail_symptom); mSymptomValueView = (AutoCompleteTextView) view.findViewById(R.id.obs_detail_symptom_value); mSymptomValueView.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable s) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (!symptomCodeBlock) { symptomCode = -1; } symptomCodeBlock = false; searchSymptoms(s.toString().trim()); } }); mSymptomValueView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> listView, View view, int position, long id) { symptomCode = (int) id; } }); // Restore UI from saved instance or load data. if (savedInstanceState != null) { findingCode = savedInstanceState.getInt(ARG_FINDING_CODE); symptomCode = savedInstanceState.getInt(ARG_SYMPTOM_CODE); mObs = (Obs) savedInstanceState.getSerializable(ARG_OBS); if (mObs != null) { mTestConcepts = savedInstanceState.getParcelableArrayList(ARG_TEST_CONCEPTS); ArrayAdapter<ListViewItem> adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item, mTestConcepts); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mTestConceptView.setAdapter(adapter); restoreView(); } } else { findingCode = -1; symptomCode = -1; loadObs(); } return view; }
From source file:com.mifos.mifosxdroid.online.GroupLoanAccountFragment.java
private void inflateInterestCalculationPeriodSpinner() { showProgress(true);//w w w.ja v a 2 s . c o m App.apiManager.getGroupLoansAccountTemplate(groupId, productId, new Callback<Response>() { @Override public void success(final Response result, Response response) { /* Activity is null - Fragment has been detached; no need to do anything. */ if (getActivity() == null) return; Log.d(LOG_TAG, ""); final List<InterestCalculationPeriodType> interestCalculationPeriodType = new ArrayList<>(); // you can use this array to populate your spinner final ArrayList<String> interestCalculationPeriodTypeNames = new ArrayList<String>(); //Try to get response body BufferedReader reader = null; StringBuilder sb = new StringBuilder(); try { reader = new BufferedReader(new InputStreamReader(result.getBody().in())); String line; while ((line = reader.readLine()) != null) { sb.append(line); } JSONObject obj = new JSONObject(sb.toString()); if (obj.has("interestCalculationPeriodTypeOptions")) { JSONArray interestCalculationPeriodTypes = obj .getJSONArray("interestCalculationPeriodTypeOptions"); for (int i = 0; i < interestCalculationPeriodTypes.length(); i++) { JSONObject interestCalculationPeriodTypeObject = interestCalculationPeriodTypes .getJSONObject(i); InterestCalculationPeriodType interestCalculationPeriod = new InterestCalculationPeriodType(); interestCalculationPeriod.setId(interestCalculationPeriodTypeObject.optInt("id")); interestCalculationPeriod .setValue(interestCalculationPeriodTypeObject.optString("value")); interestCalculationPeriodType.add(interestCalculationPeriod); interestCalculationPeriodTypeNames .add(interestCalculationPeriodTypeObject.optString("value")); interestCalculationPeriodTypeIdHashMap.put(interestCalculationPeriod.getValue(), interestCalculationPeriod.getId()); } } String stringResult = sb.toString(); } catch (Exception e) { Log.e(LOG_TAG, "", e); } final ArrayAdapter<String> interestCalculationPeriodTypeAdapter = new ArrayAdapter<>(getActivity(), layout.simple_spinner_item, interestCalculationPeriodTypeNames); interestCalculationPeriodTypeAdapter.setDropDownViewResource(layout.simple_spinner_dropdown_item); sp_interestcalculationperiod.setAdapter(interestCalculationPeriodTypeAdapter); sp_interestcalculationperiod.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { interestCalculationPeriodTypeId = interestCalculationPeriodTypeIdHashMap .get(interestCalculationPeriodTypeNames.get(i)); Log.d("interestCalculation " + interestCalculationPeriodTypeNames.get(i), String.valueOf(interestCalculationPeriodTypeId)); if (interestCalculationPeriodTypeId != -1) { } else { Toast.makeText(getActivity(), getString(R.string.error_select_interestCalculationPeriod), Toast.LENGTH_SHORT) .show(); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); showProgress(false); } @Override public void failure(RetrofitError retrofitError) { Log.d(LOG_TAG, retrofitError.getLocalizedMessage()); showProgress(false); } }); }
From source file:com.mifos.mifosxdroid.online.GroupLoanAccountFragment.java
private void inflatetransactionProcessingStrategySpinner() { showProgress(true);// w ww . jav a 2s .c om App.apiManager.getGroupLoansAccountTemplate(groupId, productId, new Callback<Response>() { @Override public void success(final Response result, Response response) { /* Activity is null - Fragment has been detached; no need to do anything. */ if (getActivity() == null) return; Log.d(LOG_TAG, ""); final List<TransactionProcessingStrategy> transactionProcessingStrategyType = new ArrayList<>(); // you can use this array to populate your spinner final ArrayList<String> transactionProcessingStrategyTypeNames = new ArrayList<String>(); //Try to get response body BufferedReader reader = null; StringBuilder sb = new StringBuilder(); try { reader = new BufferedReader(new InputStreamReader(result.getBody().in())); String line; while ((line = reader.readLine()) != null) { sb.append(line); } JSONObject obj = new JSONObject(sb.toString()); if (obj.has("transactionProcessingStrategyOptions")) { JSONArray transactionProcessingStrategyTypes = obj .getJSONArray("transactionProcessingStrategyOptions"); for (int i = 0; i < transactionProcessingStrategyTypes.length(); i++) { JSONObject transactionProcessingStrategyTypeObject = transactionProcessingStrategyTypes .getJSONObject(i); TransactionProcessingStrategy transactionProcessingStrategy = new TransactionProcessingStrategy(); transactionProcessingStrategy .setId(transactionProcessingStrategyTypeObject.optInt("id")); transactionProcessingStrategy .setName(transactionProcessingStrategyTypeObject.optString("name")); transactionProcessingStrategyType.add(transactionProcessingStrategy); transactionProcessingStrategyTypeNames .add(transactionProcessingStrategyTypeObject.optString("name")); transactionProcessingStrategyTypeIdHashMap.put(transactionProcessingStrategy.getName(), transactionProcessingStrategy.getId()); } } String stringResult = sb.toString(); } catch (Exception e) { Log.e(LOG_TAG, "", e); } final ArrayAdapter<String> transactionProcessingStrategyAdapter = new ArrayAdapter<>(getActivity(), layout.simple_spinner_item, transactionProcessingStrategyTypeNames); transactionProcessingStrategyAdapter.setDropDownViewResource(layout.simple_spinner_dropdown_item); sp_repaymentstrategy.setAdapter(transactionProcessingStrategyAdapter); sp_repaymentstrategy.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { transactionProcessingStrategyId = transactionProcessingStrategyTypeIdHashMap .get(transactionProcessingStrategyTypeNames.get(i)); Log.d("transactionProcessing " + transactionProcessingStrategyTypeNames.get(i), String.valueOf(transactionProcessingStrategyId)); if (transactionProcessingStrategyId != -1) { } else { Toast.makeText(getActivity(), getString(R.string.error_select_transactionProcessingStrategy), Toast.LENGTH_SHORT).show(); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); showProgress(false); } @Override public void failure(RetrofitError retrofitError) { Log.d(LOG_TAG, retrofitError.getLocalizedMessage()); showProgress(false); } }); }
From source file:com.gmail.taneza.ronald.carbs.main.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Log.i("Carbs", this.getClass().getSimpleName() + " onCreate"); // Restore preferences SharedPreferences prefs = getPreferences(0); mLanguage = Language.values()[prefs.getInt(PREF_LANGUAGE, Language.ENGLISH.ordinal())]; mFoodItemsList = FoodItemListSerializer.getListFromString(prefs.getString(PREF_FOOD_ITEMS_LIST, "")); mRecentFoodsList = FoodItemListSerializer.getListFromString(prefs.getString(PREF_RECENT_FOODS_LIST, "")); mFoodDbAdapter = ((CarbsApp) getApplication()).getFoodDbAdapter(); mFoodDbAdapter.setLanguage(mLanguage); pruneRecentAndFoodLists();// w w w. jav a 2 s . c om setContentView(R.layout.activity_main); mSearchEditText = (ClearableEditText) findViewById(R.id.search_text); mSearchEditTextOrigLayoutParams = (LinearLayout.LayoutParams) mSearchEditText.getLayoutParams(); mSearchEditTextFullWidthLayoutParams = new LinearLayout.LayoutParams(mSearchEditTextOrigLayoutParams); mSearchEditTextFullWidthLayoutParams.weight = 1.0f; mSearchOptionSpinner = (Spinner) findViewById(R.id.search_option_spinner); // Create an ArrayAdapter using the string array and a default spinner layout ArrayAdapter<CharSequence> arrayAdapter = ArrayAdapter.createFromResource(this, R.array.search_options_array, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices appears arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner mSearchOptionSpinner.setAdapter(arrayAdapter); mSearchOptionSpinner.setSelection(prefs.getInt(PREF_SEARCH_OPTION, FoodsFragment.SEARCH_ALL_FOODS)); mPagerAdapter = new MainPagerAdapter(getSupportFragmentManager()); mViewPager = (CustomViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mPagerAdapter); mViewPager.setOnPageChangeListener(this); mActionBar = getSupportActionBar(); mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); addActionBarTabs(); mViewPager.setCurrentItem(FOODS_TAB_INDEX); mActionBar.setHomeButtonEnabled(false); mHandler = new Handler(); refreshAllTabsAndMealTotal(); mEditFoodItemIndex = -1; }
From source file:com.mifos.mifosxdroid.online.generatecollectionsheet.GenerateCollectionSheetFragment.java
private void setSpinner(Spinner spinner, List<String> values) { ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, values);/*from w w w . j a va 2s. co m*/ adapter.notifyDataSetChanged(); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); }