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.GenerateCollectionSheetFragment.java
public void inflateGroupSpinner(final int officeId, int staffId) { Map<String, Object> params = new HashMap<String, Object>(); params.put(LIMIT, -1);//from w ww . ja va 2s . com params.put(ORDER_BY, ORDER_BY_FIELD_NAME); params.put(SORT_ORDER, ASCENDING); if (staffId >= 0) { params.put(STAFF_ID, staffId); } API.groupService.getAllGroupsInOffice(officeId, params, new Callback<List<Group>>() { @Override public void success(List<Group> groups, Response response) { List<String> groupNames = new ArrayList<String>(); groupNames.add(getString(R.string.spinner_group)); groupNameIdHashMap.put(getString(R.string.spinner_group), -1); for (Group group : groups) { groupNames.add(group.getName()); groupNameIdHashMap.put(group.getName(), group.getId()); } ArrayAdapter<String> groupAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, groupNames); groupAdapter.notifyDataSetChanged(); groupAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); sp_groups.setAdapter(groupAdapter); } @Override public void failure(RetrofitError retrofitError) { } }); }
From source file:com.example.vivek.team.EditorActivity.java
/** * Setup the dropdown spinner that allows the user to select the gender of the user. *///from w w w .ja v a 2s . com private void setupSpinner() { // Create adapter for spinner. The list options are from the String array it will use // the spinner will use the default layout ArrayAdapter genderSpinnerAdapter = ArrayAdapter.createFromResource(this, R.array.array_gender_options, android.R.layout.simple_spinner_item); // Specify dropdown layout style - simple list view with 1 item per line genderSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); // Apply the adapter to the spinner mGenderSpinner.setAdapter(genderSpinnerAdapter); // Set the integer mSelected to the constant values mGenderSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String selection = (String) parent.getItemAtPosition(position); if (!TextUtils.isEmpty(selection)) { if (selection.equals(getString(R.string.gender_male))) { mGender = GENDER_MALE; // Male } else if (selection.equals(getString(R.string.gender_female))) { mGender = GENDER_FEMALE; // Female } else { mGender = GENDER_SELECT; } } } // Because AdapterView is an abstract class, onNothingSelected must be defined @Override public void onNothingSelected(AdapterView<?> parent) { mGender = 0; // Unknown } }); }
From source file:com.rsmsa.accapp.ScreenSlidePageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.vehicle_one, container, false); tab_one = (EditText) rootView.findViewById(R.id.dob_one); Log.d("vp", "current page " + MainActivity.currentPage); Log.d("vp", "tab text " + tab_one.getText()); /**/* w ww. j av a2 s .c o m*/ * Defining all layout items **/ inputFatal = (EditText) rootView.findViewById(R.id.fatal_edit); inputInjuries = (EditText) rootView.findViewById(R.id.injury_edit); inputSimple = (EditText) rootView.findViewById(R.id.simple_edit); inputNotInjured = (EditText) rootView.findViewById(R.id.not_injured_edit); //driver 0ne details surname_one = (EditText) rootView.findViewById(R.id.surname_one); othernames_one = (EditText) rootView.findViewById(R.id.othernames_one); physical_address_one = (EditText) rootView.findViewById(R.id.physical_address_one); address_box_one = (EditText) rootView.findViewById(R.id.address_box_one); national_id_one = (EditText) rootView.findViewById(R.id.national_id_one); phone_no_one = (EditText) rootView.findViewById(R.id.phone_no_one); gender = (RadioGroup) rootView.findViewById(R.id.gender); RadioButton male = (RadioButton) rootView.findViewById(R.id.male); RadioButton female = (RadioButton) rootView.findViewById(R.id.female); nationality_one = (EditText) rootView.findViewById(R.id.nationality_one); license_one = (EditText) rootView.findViewById(R.id.license_one); occupation_one = (EditText) rootView.findViewById(R.id.occupation_one); alcohol_edit = (EditText) rootView.findViewById(R.id.alcohol_edit); drug_edit = (CheckBox) rootView.findViewById(R.id.drug_edit); phone_edit = (CheckBox) rootView.findViewById(R.id.phone_edit); seat_belt_edit = (CheckBox) rootView.findViewById(R.id.seat_belt_edit); //Vehicle one details type_one = (EditText) rootView.findViewById(R.id.type_one); registration_number_one = (EditText) rootView.findViewById(R.id.registration_number_one); //Vehicle one Insurance details company_one = (EditText) rootView.findViewById(R.id.company_one); insurance_type_one = (EditText) rootView.findViewById(R.id.insurance_type_one); insurance_phone = (EditText) rootView.findViewById(R.id.insurance_phone); policy_period_one = (EditText) rootView.findViewById(R.id.policy_period_one); policy_number_one = (EditText) rootView.findViewById(R.id.policy_number_one); repair_amount_one = (EditText) rootView.findViewById(R.id.repair_amount_one); //Vehicle one damage details vehicle = (EditText) rootView.findViewById(R.id.vehicle_title_edit); vehicle_total = (EditText) rootView.findViewById(R.id.vehicle_total_edit); infrastructure = (EditText) rootView.findViewById(R.id.infrastructure_edit); cost = (EditText) rootView.findViewById(R.id.rescue_cost_edit); //Textchange inputFatal.addTextChangedListener(new EditTextWatcher(inputFatal)); inputInjuries.addTextChangedListener(new EditTextWatcher(inputInjuries)); inputSimple.addTextChangedListener(new EditTextWatcher(inputSimple)); inputNotInjured.addTextChangedListener(new EditTextWatcher(inputNotInjured)); surname_one.addTextChangedListener(new EditTextWatcher(surname_one)); othernames_one.addTextChangedListener(new EditTextWatcher(othernames_one)); physical_address_one.addTextChangedListener(new EditTextWatcher(physical_address_one)); address_box_one.addTextChangedListener(new EditTextWatcher(address_box_one)); national_id_one.addTextChangedListener(new EditTextWatcher(national_id_one)); phone_no_one.addTextChangedListener(new EditTextWatcher(phone_no_one)); inputFatal.addTextChangedListener(new EditTextWatcher(inputFatal)); inputInjuries.addTextChangedListener(new EditTextWatcher(inputInjuries)); inputSimple.addTextChangedListener(new EditTextWatcher(inputSimple)); inputNotInjured.addTextChangedListener(new EditTextWatcher(inputNotInjured)); // gender.addTextChangedListener(new EditTextWatcher(gender)); nationality_one.addTextChangedListener(new EditTextWatcher(nationality_one)); license_one.addTextChangedListener(new EditTextWatcher(license_one)); occupation_one.addTextChangedListener(new EditTextWatcher(occupation_one)); alcohol_edit.addTextChangedListener(new EditTextWatcher(alcohol_edit)); //drug_edit.addTextChangedListener(new EditTextWatcher(drug_edit)); //phone_edit.addTextChangedListener(new EditTextWatcher(phone_edit)); //seat_belt_edit.addTextChangedListener(new EditTextWatcher(seat_belt_edit)); type_one.addTextChangedListener(new EditTextWatcher(type_one)); registration_number_one.addTextChangedListener(new EditTextWatcher(registration_number_one)); company_one.addTextChangedListener(new EditTextWatcher(company_one)); insurance_type_one.addTextChangedListener(new EditTextWatcher(insurance_type_one)); insurance_phone.addTextChangedListener(new EditTextWatcher(insurance_phone)); policy_period_one.addTextChangedListener(new EditTextWatcher(policy_period_one)); policy_number_one.addTextChangedListener(new EditTextWatcher(policy_number_one)); repair_amount_one.addTextChangedListener(new EditTextWatcher(repair_amount_one)); vehicle.addTextChangedListener(new EditTextWatcher(vehicle)); vehicle_total.addTextChangedListener(new EditTextWatcher(vehicle_total)); infrastructure.addTextChangedListener(new EditTextWatcher(infrastructure)); cost.addTextChangedListener(new EditTextWatcher(cost)); vehicle_category = (Spinner) rootView.findViewById(R.id.vtype_spinner); vehicle_type = (Button) rootView.findViewById(R.id.vehicle_type_select_button); cal = Calendar.getInstance(); day = cal.get(Calendar.DAY_OF_MONTH); month = cal.get(Calendar.MONTH); year = cal.get(Calendar.YEAR); pickDate = (Button) rootView.findViewById(R.id.date_picker); pickDate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(), datePickerListener, year, month, day); datePickerDialog.show(); } }); List<String> vehicle_category_list = new ArrayList<String>(); vehicle_category_list.add("Private"); vehicle_category_list.add("Commercial"); vehicle_category_list.add("Government"); vehicle_category_list.add("Emergency"); vehicle_category_list.add("Passenger Service Vehicles"); vehicle_category.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { selectedSpinner = i; if (i == 0) { selectedSpinner = 234; } } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); vehicle_type.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(getActivity(), VehicleType.class); intent.putExtra("category", selectedSpinner + ""); startActivity(intent); } }); ArrayAdapter<String> atc_adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, vehicle_category_list); atc_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); vehicle_category.setAdapter(atc_adapter); return rootView; }
From source file:eu.vranckaert.worktime.utils.donations.DonationsFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); /* Flattr *///from w w w . java 2s . co m if (DonationsUtils.getResourceBoolean(getActivity(), "donations__flattr_enabled")) { // inflate flattr view into stub ViewStub flattrViewStub = (ViewStub) getActivity().findViewById(R.id.donations__flattr_stub); flattrViewStub.inflate(); buildFlattrView(); } /* Google */ mGoogleEnabled = DonationsUtils.getResourceBoolean(getActivity(), "donations__google_enabled"); if (mGoogleEnabled) { // inflate google view into stub ViewStub googleViewStub = (ViewStub) getActivity().findViewById(R.id.donations__google_stub); googleViewStub.inflate(); // get catalog from xml config CATALOG = DonationsUtils.getResourceStringArray(getActivity(), "donations__google_catalog"); // choose donation amount mGoogleSpinner = (Spinner) getActivity().findViewById(R.id.donations__google_android_market_spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.donations__google_android_market_promt_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mGoogleSpinner.setAdapter(adapter); mHandler = new Handler(); mDonatePurchaseObserver = new DonatePurchaseObserver(mHandler); mBillingService = new BillingService(); mBillingService.setContext(getActivity()); 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); } }); } /* PayPal */ if (DonationsUtils.getResourceBoolean(getActivity(), "donations__paypal_enabled")) { // 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:org.elasticdroid.SshConnectorView.java
/** * Method called to populate the open ports spinner in the UI */// ww w . j av a 2 s . c o m private void populateSpinner() { if (openPorts == null) { return; } int selectedIndex = 0; //set selected index to index of port 22 if available. Spinner portSpinner = (Spinner) findViewById(R.id.sshConnectorPortSpinner); if (openPorts.contains("22")) { Log.d(TAG, "Found port 22 in openPorts.Setting as selected."); selectedIndex = openPorts.indexOf("22"); } //create an ArrayAdapter<String> to hold this ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, openPorts); spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); portSpinner.setAdapter(spinnerAdapter); portSpinner.setSelection(selectedIndex); //0 if port 22 unavailable, else indexof(port22) }
From source file:no.ntnu.idi.socialhitchhiking.map.MapActivityJourney.java
/** * sends a message to the driver of a journey *//*from w w w. j a v a2s . com*/ private void sendMessageToDriver() { final Dialog customDialog = new Dialog(this); customDialog.setContentView(R.layout.custom_dialog_layout); customDialog.setTitle("Message"); final List<String> spinnerArray = new ArrayList<String>(); spinnerArray.add("Everyone"); if (!getApp().getSelectedJourney().getDriver().equals(getApp().getUser())) { spinnerArray.add(getApp().getSelectedJourney().getDriver().getFullName()); } for (int i = 0; i < getApp().getSelectedJourney().getHitchhikers().size(); i++) { if (!getApp().getSelectedJourney().getHitchhikers().get(i).equals(getApp().getUser())) { spinnerArray.add(getApp().getSelectedJourney().getHitchhikers().get(i).getFullName()); } } final Spinner spinner = (Spinner) customDialog.findViewById(R.id.spinner); ArrayAdapter<String> adapter = new ArrayAdapter<String>(MapActivityJourney.this, android.R.layout.simple_spinner_item, spinnerArray); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); ImageView sendBtn = (ImageView) customDialog.findViewById(R.id.sendBtn); final EditText input = (EditText) customDialog.findViewById(R.id.input); sendBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { User mid = getApp().getUser(); if (spinner.getSelectedItem().toString().equals("Everyone")) { if (input.getText().toString().equals("")) { input.setHint("Please fill in your message"); Toast toast = Toast.makeText(MapActivityJourney.this, "Please fill in your message", Toast.LENGTH_SHORT); toast.setGravity(Gravity.BOTTOM, toast.getXOffset() / 2, toast.getYOffset() / 2); toast.show(); } else { List<User> userList = new ArrayList<User>(); userList.add(getApp().getSelectedJourney().getDriver()); for (int k = 0; k < getApp().getSelectedJourney().getHitchhikers().size(); k++) { userList.add(getApp().getSelectedJourney().getHitchhikers().get(k)); } userList.remove(getApp().getUser()); for (int k = 0; k < userList.size(); k++) { sendMessage(userList.get(k), input); } Toast toast = Toast.makeText(MapActivityJourney.this, "Message sent", Toast.LENGTH_SHORT); toast.setGravity(Gravity.BOTTOM, toast.getXOffset() / 2, toast.getYOffset() / 2); toast.show(); customDialog.dismiss(); } } else { for (int j = 0; j < getApp().getSelectedJourney().getHitchhikers().size(); j++) { if (spinner.getSelectedItem().toString() .equals(getApp().getSelectedJourney().getHitchhikers().get(j).getFullName())) { mid = getApp().getSelectedJourney().getHitchhikers().get(j); } } if (spinner.getSelectedItem().toString() .equals(getApp().getSelectedJourney().getDriver().getFullName())) { mid = getApp().getSelectedJourney().getDriver(); } if (input.getText().toString().equals("")) { input.setHint("Please fill in your message"); Toast toast = Toast.makeText(MapActivityJourney.this, "Please fill in your message", Toast.LENGTH_SHORT); toast.setGravity(Gravity.BOTTOM, toast.getXOffset() / 2, toast.getYOffset() / 2); toast.show(); } else { sendMessage(mid, input); Toast toast = Toast.makeText(MapActivityJourney.this, "Message sent", Toast.LENGTH_SHORT); toast.setGravity(Gravity.BOTTOM, toast.getXOffset() / 2, toast.getYOffset() / 2); toast.show(); customDialog.dismiss(); } } } }); customDialog.show(); }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Display dialog to allow user to select which row to add the shortcut. For * TV channels let the user change the channel name. * /*from ww w . j av a 2 s . co m*/ * @see InstallShortcutReceiver * * @param context * @param name * @param icon * @param uri */ public static void displayShortcutsRowSelection(final Launcher context, final String name, final String icon, final String uri) { if (uri == null) { return; } final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); final boolean isChannel = uri.startsWith("tv"); dialog.setContentView(R.layout.select_row); final TextView channelTextView = (TextView) dialog.findViewById(R.id.channelText); final EditText channelNameEditText = (EditText) dialog.findViewById(R.id.channelName); if (isChannel) { channelTextView.setVisibility(View.VISIBLE); channelNameEditText.setVisibility(View.VISIBLE); channelNameEditText.setText(name); } final TextView selectTextView = (TextView) dialog.findViewById(R.id.selectText); selectTextView.setText(context.getString(R.string.dialog_select_row, name)); final Spinner spinner = (Spinner) dialog.findViewById(R.id.spinner); final EditText nameEditText = (EditText) dialog.findViewById(R.id.rowName); final RadioButton currentRadioButton = (RadioButton) dialog.findViewById(R.id.currentRadio); currentRadioButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // hide the row name edit field if the current row radio button // is selected nameEditText.setVisibility(View.GONE); spinner.setVisibility(View.VISIBLE); } }); final RadioButton newRadioButton = (RadioButton) dialog.findViewById(R.id.newRadio); newRadioButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // show the row name edit field if the new radio button is // selected nameEditText.setVisibility(View.VISIBLE); nameEditText.requestFocus(); spinner.setVisibility(View.GONE); } }); List<String> list = new ArrayList<String>(); final ArrayList<RowInfo> rows = RowsTable.getRows(context); if (rows != null) { for (RowInfo row : rows) { list.add(row.getTitle()); } } ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context, R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item); spinner.setAdapter(dataAdapter); Button buttonYes = (Button) dialog.findViewById(R.id.buttonOk); buttonYes.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String shortcutName = name; try { if (isChannel) { String channelName = channelNameEditText.getText().toString().trim(); if (channelName.length() == 0) { channelNameEditText.requestFocus(); displayAlert(context, context.getString(R.string.dialog_channel_name_alert)); return; } shortcutName = channelName; } // if the new row radio button is selected, the user must // enter a name for the new row String rowName = nameEditText.getText().toString().trim(); if (newRadioButton.isChecked() && rowName.length() == 0) { nameEditText.requestFocus(); displayAlert(context, context.getString(R.string.dialog_new_row_name_alert)); return; } boolean currentRow = !newRadioButton.isChecked(); int rowId = 0; int rowPosition = 0; if (currentRow) { if (rows != null) { String selectedRow = (String) spinner.getSelectedItem(); for (RowInfo row : rows) { if (row.getTitle().equals(selectedRow)) { rowId = row.getId(); ArrayList<ItemInfo> items = ItemsTable.getItems(context, rowId); rowPosition = items.size(); // in last // position // for selected // row break; } } } } else { rowId = (int) RowsTable.insertRow(context, rowName, 0, RowInfo.FAVORITE_TYPE); rowPosition = 0; } Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(uri)); ItemsTable.insertItem(context, rowId, rowPosition, shortcutName, intent, icon, DatabaseHelper.SHORTCUT_TYPE); Toast.makeText(context, context.getString(R.string.shortcut_installed, shortcutName), Toast.LENGTH_SHORT).show(); context.reloadAllGalleries(); if (currentRow) { Analytics.logEvent(Analytics.ADD_SHORTCUT); } else { Analytics.logEvent(Analytics.ADD_SHORTCUT_WITH_ROW); } } catch (Exception e) { Log.d(LOG_TAG, "onClick", e); } context.showCover(false); dialog.dismiss(); } }); Button buttonNo = (Button) dialog.findViewById(R.id.buttonCancel); buttonNo.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { context.showCover(false); dialog.dismiss(); } }); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_ADD_SHORTCUT); }
From source file:de.damdi.fitness.activity.start_training.DialogFragmentAddEntry.java
/** * Fills the spinners with entries, e.g. with "1 kg"(weight_spinner) or just * numbers.//from w w w.j a v a 2s . c om */ private void fillSpinners() { List<String> durationList = new ArrayList<String>(); for (Integer i = 1; i <= 120; i++) { durationList.add(i.toString()); } ArrayAdapter<String> durationAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, durationList); durationAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner_duration.setAdapter(durationAdapter); List<String> repetitionList = new ArrayList<String>(); for (int i = 1; i <= 120; i++) { repetitionList.add(i + " x"); } ArrayAdapter<String> repetitionAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, repetitionList); repetitionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner_repetitions.setAdapter(repetitionAdapter); List<String> weightList = new ArrayList<String>(); for (int i = 250; i <= 1000; i += 250) { weightList.add(i / 1000 + "," + i % 1000 + " kg"); } for (int i = 1500; i <= 5000; i += 500) { weightList.add(i / 1000 + "," + i % 1000 + " kg"); } for (int i = 6000; i <= 200000; i += 1000) { weightList.add(i / 1000 + "," + i % 1000 + " kg"); } for (int i = 205000; i <= 400000; i += 5000) { weightList.add(i / 1000 + "," + i % 1000 + " kg"); } for (int i = 410000; i <= 500000; i += 10000) { weightList.add(i / 1000 + "," + i % 1000 + " kg"); } ArrayAdapter<String> weightAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, weightList); weightAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner_weight.setAdapter(weightAdapter); checkbox_duration.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton button, boolean val) { spinner_duration.setEnabled(val); spinner_duration_unit.setEnabled(val); } }); checkbox_weight.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton button, boolean val) { spinner_weight.setEnabled(val); } }); checkbox_repetitions.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton button, boolean val) { spinner_repetitions.setEnabled(val); } }); checkbox_duration.setChecked(true); checkbox_weight.setChecked(true); checkbox_repetitions.setChecked(true); }
From source file:edu.asu.msse.sgowdru.moviesqldb.SearchMovie.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.search_movie); info = new TextView[5]; //In the info array of TextView type store id of each field info[0] = (TextView) findViewById(R.id.autoCompleteTextView); info[1] = (TextView) findViewById(R.id.editTitleSearch); info[2] = (TextView) findViewById(R.id.editGenreSearch); info[3] = (TextView) findViewById(R.id.editYearSearch); info[4] = (TextView) findViewById(R.id.editActorsSearch); //Ratings field is of type Spinner class with field values (PG, PG-13, R rated) dropdown = (Spinner) findViewById(R.id.spinnerSearch); adapter = ArrayAdapter.createFromResource(this, R.array.Ratings, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); dropdown.setAdapter(adapter);/*from ww w. j ava2 s .com*/ btn = (Button) findViewById(R.id.addSearch); context = getApplicationContext(); duration = Toast.LENGTH_LONG; db = new MoviesDB(this); try { crsDB = db.openDB(); } catch (SQLException e) { e.printStackTrace(); } ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, gen); AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.editGenreSearch); textView.setAdapter(adapter); }
From source file:com.mifos.mifosxdroid.online.GenerateCollectionSheetFragment.java
public void inflateStaffSpinner(final int officeId) { API.staffService.getStaffForOffice(officeId, new Callback<List<Staff>>() { @Override//from www .java 2 s . c o m public void success(List<Staff> staffs, Response response) { final List<String> staffNames = new ArrayList<String>(); staffNames.add(getString(R.string.spinner_staff)); staffNameIdHashMap.put(getString(R.string.spinner_staff), -1); for (Staff staff : staffs) { staffNames.add(staff.getDisplayName()); staffNameIdHashMap.put(staff.getDisplayName(), staff.getId()); } ArrayAdapter<String> staffAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, staffNames); staffAdapter.notifyDataSetChanged(); staffAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); sp_loan_officers.setAdapter(staffAdapter); sp_loan_officers.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { int staffId = staffNameIdHashMap.get(staffNames.get(position)); if (staffId != -1) { inflateCenterSpinner(officeId, staffId); inflateGroupSpinner(officeId, staffId); } else { Toast.makeText(getActivity(), getString(R.string.error_select_staff), Toast.LENGTH_SHORT).show(); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); } @Override public void failure(RetrofitError retrofitError) { System.out.println(retrofitError.getLocalizedMessage()); } }); }