List of usage examples for android.widget Spinner setAdapter
@Override public void setAdapter(SpinnerAdapter adapter)
From source file:fm.smart.r1.activity.CreateItemActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ExceptionHandler.register(this); setContentView(R.layout.create_item); final Intent queryIntent = getIntent(); Bundle extras = queryIntent.getExtras(); list_id = (String) extras.get("list_id"); cue = (String) extras.get("cue"); response = (String) extras.get("response"); cue_language = (String) extras.get("cue_language"); response_language = (String) extras.get("response_language"); character_cue = (String) extras.get("character_cue"); character_response = (String) extras.get("character_response"); pos = (String) extras.get("pos"); Button button = (Button) findViewById(R.id.create_item_submit); button.setOnClickListener(this); TextView cue_text = (TextView) findViewById(R.id.cue); if (!TextUtils.isEmpty(cue)) { cue_text.setText(cue);/*from w w w . j a v a 2 s. co m*/ } TextView response_text = (TextView) findViewById(R.id.response); if (!TextUtils.isEmpty(response)) { response_text.setText(response); } TextView cue_character_text = (TextView) findViewById(R.id.cue_character); if (!TextUtils.isEmpty(character_cue)) { cue_character_text.setText(character_cue); } TextView response_character_text = (TextView) findViewById(R.id.response_character); if (!TextUtils.isEmpty(character_response)) { response_character_text.setText(character_response); } TextView cue_legend = (TextView) findViewById(R.id.create_item_cue_legend); cue_legend.setText(Utils.INV_LANGUAGE_MAP.get(cue_language) + " Term"); TextView response_legend = (TextView) findViewById(R.id.create_item_response_legend); response_legend.setText(Utils.INV_LANGUAGE_MAP.get(response_language) + " Term"); TextView cue_character_textView = (TextView) findViewById(R.id.create_item_cue_character); cue_character_textView.setText(Utils.INV_LANGUAGE_MAP.get(cue_language) + " Character Text"); TextView response_character_textView = (TextView) findViewById(R.id.create_item_response_character); response_character_textView.setText(Utils.INV_LANGUAGE_MAP.get(response_language) + " Character Text"); List<String> pos_list = new Vector<String>(Utils.POS_MAP.keySet()); Collections.sort(pos_list); ArrayAdapter<String> pos_adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, pos_list); // .simple_spinner_item Spinner pos_textView = (Spinner) findViewById(R.id.pos); pos_textView.setAdapter(pos_adapter); if (!TextUtils.isEmpty(pos)) { pos_textView.setSelection(pos_list.indexOf(pos)); } else { pos_textView.setSelection(pos_list.indexOf("Noun")); } EditText cue_character_input_textView = (EditText) findViewById(R.id.cue_character); if (!Utils.isIdeographicLanguage(Main.search_lang)) { cue_character_textView.setVisibility(View.GONE); cue_character_input_textView.setVisibility(View.GONE); } else if (!TextUtils.isEmpty(character_cue)) { cue_character_input_textView.setText(character_cue); } EditText response_character_input_textView = (EditText) findViewById(R.id.response_character); if (!Utils.isIdeographicLanguage(Main.result_lang)) { response_character_textView.setVisibility(View.GONE); response_character_input_textView.setVisibility(View.GONE); } else if (!TextUtils.isEmpty(character_response)) { response_character_input_textView.setText(character_response); } }
From source file:com.anton.gavel.PersonalInfoDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); dialogView = inflater.inflate(R.layout.dialog_personal_info, null); Spinner spinner = (Spinner) dialogView.findViewById(R.id.personal_cities_spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.cities, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); builder.setView(dialogView).setTitle("Personal Information") .setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override/*from w w w . j a va 2 s . co m*/ public void onClick(DialogInterface dialog, int id) { mListener.onDialogPositiveClick(PersonalInfoDialogFragment.this); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { PersonalInfoDialogFragment.this.getDialog().cancel(); } }); populatePersonalInfo(); return builder.create(); }
From source file:org.mifos.androidclient.templates.OperationFormActivity.java
public void replaceComboBoxItems(Spinner comboBox, List<String> items) { comboBox.setAdapter(new ArrayAdapter(this, R.layout.combo_box_item, items)); }
From source file:nl.jalava.appostle.SortDialog.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.sort_dialog, container, false); getDialog().setTitle(getString(R.string.sort_title)); // Alphabetically or by name. final Spinner spinner_types = (Spinner) v.findViewById(R.id.sort_type_spinner); ArrayAdapter<CharSequence> adapter_types = ArrayAdapter.createFromResource(getActivity(), R.array.sort_types, android.R.layout.simple_spinner_item); adapter_types.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner_types.setAdapter(adapter_types); spinner_types.setSelection(mSort);/* w w w. ja va 2 s. c o m*/ // Ascending or descending. final Spinner spinner_directions = (Spinner) v.findViewById(R.id.sort_direction_spinner); ArrayAdapter<CharSequence> adapter_directions = ArrayAdapter.createFromResource(getActivity(), R.array.sort_directions, android.R.layout.simple_spinner_item); adapter_directions.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner_directions.setAdapter(adapter_directions); spinner_directions.setSelection(mDir); Button OK_Button = (Button) v.findViewById(R.id.ok_button); OK_Button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSort = spinner_types.getSelectedItemPosition(); mDir = spinner_directions.getSelectedItemPosition(); SortDialogListener activity = (SortDialogListener) getActivity(); activity.onFinishSortDialog(mSort, mDir); dismiss(); } }); Button Cancel_Button = (Button) v.findViewById(R.id.cancelButton); Cancel_Button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); return v; }
From source file:de.quist.app.maps.example.LayersDemoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layers_demo); Spinner spinner = (Spinner) findViewById(R.id.layers_spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.layers_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); mTrafficCheckbox = (CheckBox) findViewById(R.id.traffic); mMyLocationCheckbox = (CheckBox) findViewById(R.id.my_location); mBuildingsCheckbox = (CheckBox) findViewById(R.id.buildings); mIndoorCheckbox = (CheckBox) findViewById(R.id.indoor); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); }
From source file:mx.com.adolfogarcia.popularmovies.view.fragment.MovieCollectionFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_fragment_movie_collection, menu); MenuItem item = menu.findItem(R.id.menu_item_sort_order); Spinner spinner = (Spinner) MenuItemCompat.getActionView(item); ArrayAdapter<LabeledItem<FetchMoviePageTaskFactory>> adapter = new ArrayAdapter<>(getActivity(), R.layout.list_item_sort_order, mViewModel.getSortOrderOptions()); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(mViewModel); spinner.setSelection(mViewModel.getSelectedSortOrderIndex()); }
From source file:com.explovia.mapdemo.LayersDemoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layers_demo); Spinner spinner = (Spinner) findViewById(R.id.layers_spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.layers_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); mTrafficCheckbox = (CheckBox) findViewById(R.id.traffic); mMyLocationCheckbox = (CheckBox) findViewById(R.id.my_location); mBuildingsCheckbox = (CheckBox) findViewById(R.id.buildings); mIndoorCheckbox = (CheckBox) findViewById(R.id.indoor); setUpMapIfNeeded();//from w w w . j ava 2 s. co m }
From source file:fr.eoit.activity.fragment.mining.session.AddItemToCargoDialog.java
@Override protected void onCreateSimpleDialog(View inflatedLayout, Bundle savedInstanceState) { this.inflatedLayout = inflatedLayout; Spinner itemSpinner = (Spinner) inflatedLayout.findViewById(R.id.item_spinner); adapter = new SimpleCursorAdapter(getActivity(), android.R.layout.simple_dropdown_item_1line, null, SPINNER_CURSOR_COLUMNS, SPINNER_VIEW_IDS, SimpleCursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER); itemSpinner.setAdapter(adapter); itemSpinner.setOnItemSelectedListener(new AddItemOnItemSelectedListenet()); NumberFormat nf = new DecimalFormat(EOITConst.VALUES_WITHOUT_SEPARATOR_PATTERN); EditText editText = (EditText) inflatedLayout.findViewById(R.id.item_quantity); editText.setText(nf.format(quantity)); editText.setOnKeyListener(new ItemQuantityOnKeyListener()); }
From source file:com.joefernandez.irrduino.android.remote.IrrduinoRemoteActivity.java
/** Called when the activity is first created. */ @Override//from w w w .j a v a2 s. c om public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Spinner spinnerRunTime = (Spinner) findViewById(R.id.spinner_runtimes); spinnerRunTime.setAdapter(getSpinnerAdapter()); spinnerRunTime.setOnItemSelectedListener(new RuntimeItemSelectedListener()); statusText = (EditText) findViewById(R.id.status_text); Bundle extras = getIntent().getExtras(); if (extras != null) { String value = extras.getString("taskResult"); if (value != null && value.length() > 0) { statusText.setText(value); } } Button allOff = (Button) findViewById(R.id.button_all_stop); allOff.setOnClickListener(new OnClickListener() { public void onClick(View v) { statusText.setText("Sending..."); new IrrduinoCommandTask().execute(getControllerAddress() + CMD_ALL_OFF); } }); Button zone1 = (Button) findViewById(R.id.button_garden); zone1.setOnClickListener(new OnClickListener() { public void onClick(View v) { sendZoneRunCommand(ZONE_GARDEN, zoneRunTime); } }); Button zone2 = (Button) findViewById(R.id.button_backyard_lawn_1); zone2.setOnClickListener(new OnClickListener() { public void onClick(View v) { sendZoneRunCommand(ZONE_BACK_LAWN1, zoneRunTime); } }); Button zone3 = (Button) findViewById(R.id.button_backyard_lawn_2); zone3.setOnClickListener(new OnClickListener() { public void onClick(View v) { sendZoneRunCommand(ZONE_BACK_LAWN2, zoneRunTime); } }); Button zone4 = (Button) findViewById(R.id.button_backyard_lawn_3); zone4.setOnClickListener(new OnClickListener() { public void onClick(View v) { sendZoneRunCommand(ZONE_BACK_LAWN3, zoneRunTime); } }); Button zone5 = (Button) findViewById(R.id.button_patio_plants); zone5.setOnClickListener(new OnClickListener() { public void onClick(View v) { sendZoneRunCommand(ZONE_PATIO, zoneRunTime); } }); // Zone 6 (backyard left side flower beds, is not hooked up) // Button zone6 = (Button) findViewById(R.id.button_patio_plants); // zone6.setOnClickListener(new OnClickListener() { // public void onClick(View v) { // sendZoneRunCommand(ZONE_FLOWER_BED, zoneRunTime); // } // }); Button zone7 = (Button) findViewById(R.id.button_frontyard_lawn_1); zone7.setOnClickListener(new OnClickListener() { public void onClick(View v) { sendZoneRunCommand(ZONE_FRONT_LAWN1, zoneRunTime); } }); Button zone8 = (Button) findViewById(R.id.button_frontyard_lawn_2); zone8.setOnClickListener(new OnClickListener() { public void onClick(View v) { sendZoneRunCommand(ZONE_FRONT_LAWN2, zoneRunTime); } }); // Request global status from controller (run *last*) requestSystemStatus(); }
From source file:com.emobc.android.activities.generators.FormActivityGenerator.java
private View insertPickerField(Activity activity, FormDataItem dataItem) { Spinner spinner = new Spinner(activity); ArrayAdapter<String> adapter = new ArrayAdapter<String>(activity, android.R.layout.simple_spinner_item, dataItem.getParameters());//from www . j a v a2 s. com spinner.setAdapter(adapter); return spinner; }