@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.second_activity); button1 = (Button) findViewById(R.id.button1); button1.setOnClickListener(this); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, data2); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner = (Spinner) findViewById(R.id.spinner1); spinner.setAdapter(adapter); ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, data); adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner2 = (Spinner) findViewById(R.id.spinner2); spinner2.setAdapter(adapter2); editText1 = (EditText) findViewById(R.id.editText1); editText1.setOnClickListener(this); editText2 = (EditText) findViewById(R.id.editText2); editText2.setOnClickListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.user_profile); etudob = (EditText) findViewById(R.id.etudob); etudob.setOnClickListener(this); etuvid = (EditText) findViewById(R.id.etuvid); etuprof = (EditText) findViewById(R.id.etuprof); etuloc = (EditText) findViewById(R.id.etuloc); spuc = (Spinner) findViewById(R.id.spuc); etuinc = (Spinner) findViewById(R.id.etuinc); etums = (Spinner) findViewById(R.id.etums); ArrayAdapter<String> adapterm = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, marital_status); adapterm.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); etums.setAdapter(adapterm); ArrayAdapter<String> adapterc = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, caste); adapterc.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spuc.setAdapter(adapterc); ArrayAdapter<String> adapteri = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, income); adapteri.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); etuinc.setAdapter(adapteri); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); spin = (Spinner) findViewById(R.id.spiner); ArrayAdapter<CharSequence> ar = ArrayAdapter.createFromResource(this, R.array.foody, android.R.layout.simple_list_item_1); ar.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); spin.setAdapter(ar); spin1 = (Spinner) findViewById(R.id.spiner1); ArrayAdapter<CharSequence> arr = ArrayAdapter.createFromResource(this, R.array.foody, android.R.layout.simple_list_item_1); arr.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); spin1.setAdapter(arr); // Get TabHost Refference tabHost = getTabHost(); // Set TabChangeListener called when tab changed tabHost.setOnTabChangedListener(this); TabHost.TabSpec spec; Intent intent; /** *********** TAB1 *********** */ // Create Intents to launch an Activity for the tab (to be reused) intent = new Intent().setClass(this, map.class); spec = tabHost.newTabSpec("First").setIndicator("").setContent(intent); // Add intent to tab tabHost.addTab(spec); /** *********** TAB2 *********** */ intent = new Intent().setClass(this, loginfd.class); spec = tabHost.newTabSpec("Second").setIndicator("").setContent(intent); tabHost.addTab(spec); /** *********** TAB3 *********** */ intent = new Intent().setClass(this, map.class); spec = tabHost.newTabSpec("Third").setIndicator("").setContent(intent); tabHost.addTab(spec); /** *********** TAB4 *********** */ intent = new Intent().setClass(this, loginfd.class); spec = tabHost.newTabSpec("Third").setIndicator("").setContent(intent); tabHost.addTab(spec); /** *********** TAB5 *********** */ intent = new Intent().setClass(this, map.class); spec = tabHost.newTabSpec("Third").setIndicator("").setContent(intent); tabHost.addTab(spec); /** *********** TAB6 *********** */ intent = new Intent().setClass(this, map.class); spec = tabHost.newTabSpec("Third").setIndicator("").setContent(intent); tabHost.addTab(spec); // Set drawable images to tab tabHost.getTabWidget().getChildAt(0).setBackgroundResource(R.drawable.foody); tabHost.getTabWidget().getChildAt(1).setBackgroundResource(R.drawable.ecart); tabHost.getTabWidget().getChildAt(2).setBackgroundResource(R.drawable.tim); tabHost.getTabWidget().getChildAt(3).setBackgroundResource(R.drawable.thongbao); tabHost.getTabWidget().getChildAt(4).setBackgroundResource(R.drawable.mune); tabHost.getTabWidget().getChildAt(5).setBackgroundResource(R.drawable.nd); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_anim_examples); effects = (Spinner) findViewById(R.id.effects); interpolators = (Spinner) findViewById(R.id.interpolators); img = (ImageView) findViewById(R.id.img); duration = (EditText) findViewById(R.id.duration); factor = (EditText) findViewById(R.id.factor); repeatModes = (Spinner) findViewById(R.id.repeat_modes); effects.setAdapter( new ArrayAdapter( this, android.R.layout.simple_spinner_item, getResources().getTextArray(R.array.anim_effects))); interpolators.setAdapter( new ArrayAdapter( this, android.R.layout.simple_spinner_item, getResources().getTextArray(R.array.interpolators))); repeatModes.setAdapter( new ArrayAdapter( this, android.R.layout.simple_spinner_item, new String[] {"none", "infinite", "restart", "reverse"})); }
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { if (parent.getItemAtPosition(pos).equals("AP")) { Spinner apChoice = (Spinner) findViewById(R.id.subChoiceSpinner); ArrayAdapter<CharSequence> adapter1 = ArrayAdapter.createFromResource( this, R.array.apChoices_array, android.R.layout.simple_spinner_item); adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); apChoice.setAdapter(adapter1); } else if (parent.getItemAtPosition(pos).equals("Subject SAT")) { Spinner sat = (Spinner) findViewById(R.id.subChoiceSpinner); ArrayAdapter<CharSequence> adapter1 = ArrayAdapter.createFromResource( this, R.array.subjectSat_array, android.R.layout.simple_spinner_item); adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); sat.setAdapter(adapter1); } else if (parent.getItemAtPosition(pos).equals("School Subjects")) { Spinner schoolSubject = (Spinner) findViewById(R.id.subChoiceSpinner); ArrayAdapter<CharSequence> adapter1 = ArrayAdapter.createFromResource( this, R.array.schoolsubject_array, android.R.layout.simple_spinner_item); adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); schoolSubject.setAdapter(adapter1); } }
private void populateSpinners() { // Populate Class Tables Class_spinner = (Spinner) findViewById(R.id.spinner_search_class); DataBaseHelper readDB = new DataBaseHelper(getApplicationContext()); ArrayList<String> classNames = readDB.retireveAllClassNames(); ClassAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, classNames); ClassAdapter.setDropDownViewResource(R.layout.spinner_layout_dropdown); Class_spinner.setAdapter(ClassAdapter); readDB.close(); // Populate Race Spinner Race_spinner = (Spinner) findViewById(R.id.spinner_search_race); RaceAdapter = ArrayAdapter.createFromResource(this, R.array.Races, android.R.layout.simple_spinner_item); RaceAdapter.setDropDownViewResource(R.layout.spinner_layout_dropdown); Race_spinner.setAdapter(RaceAdapter); // Populate Alignment Spinner Alignment_spinner = (Spinner) findViewById(R.id.spinner_search_alignment); AlignmentAdapter = ArrayAdapter.createFromResource( this, R.array.Alignments, android.R.layout.simple_spinner_item); AlignmentAdapter.setDropDownViewResource(R.layout.spinner_layout_dropdown); Alignment_spinner.setAdapter(AlignmentAdapter); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_new_incident, container, false); String[] type = {"Qualidade", "Segurança", "Mecânica", "Supermercado"}; Integer[] line = {1, 2, 3, 4, 5}; Integer[] station = {1, 2, 3, 4, 5}; ArrayAdapter<String> stringTypeArrayAdapter = new ArrayAdapter<String>(this.getActivity(), R.layout.spinner_item, type); spinnerType = (Spinner) v.findViewById(R.id.spnType); spinnerType.setAdapter(stringTypeArrayAdapter); ArrayAdapter<Integer> integerLineArrayAdapter = new ArrayAdapter<Integer>(this.getActivity(), R.layout.spinner_item, line); spinnerLine = (Spinner) v.findViewById(R.id.line); spinnerLine.setAdapter(integerLineArrayAdapter); ArrayAdapter<Integer> integerStationArrayAdapter = new ArrayAdapter<Integer>(this.getActivity(), R.layout.spinner_item, station); spinnerStation = (Spinner) v.findViewById(R.id.station); spinnerStation.setAdapter(integerStationArrayAdapter); addListenerOnButton(v); return v; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); effect = (TextView) findViewById(R.id.effect); effect.setSelected(true); initial_temp = (Spinner) findViewById(R.id.type); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource( MainActivity.this, R.array.temp, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); initial_temp.setAdapter(adapter); conv_to = (Spinner) findViewById(R.id.conv_to); conv_to.setAdapter(adapter); tv = (TextView) findViewById(R.id.tv); btn = (Button) findViewById(R.id.avanti); value = (EditText) findViewById(R.id.value); btn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { convertTemp(); } }); }
private void loadSpinnerData() { Boolean isThereData = null; Cursor cursor = getActivity() .getContentResolver() .query(MyContentProvider.CONTENT_URI_VIEW_USER_APPLICATION, null, null, null, null); isThereData = cursor != null && cursor.moveToFirst(); mAdapter = new SimpleCursorAdapter( getActivity(), R.layout.spinner_item_row_selected_fill, null, new String[] {MyContentProvider.APPLICATION_TYPE_NAME}, new int[] {R.id.spinnerDropdownItem}, 0); mAdapter.setDropDownViewResource(R.layout.spinner_item_row_dropdown); appSpinner.setBackgroundColor(getResources().getColor(android.R.color.transparent)); if (isThereData) { appSpinner.setAdapter(mAdapter); getActivity().getLoaderManager().initLoader(0, null, this); } else { appSpinner.setAdapter( new NothingSelectedSpinnerAdapter( mAdapter, R.layout.spinner_item_row_prompt, // R.layout.contact_spinner_nothing_selected_dropdown, // Optional getActivity())); getActivity().getLoaderManager().initLoader(0, null, this); } }
public void setSpinerAdapter() { ArrayAdapter<String> spinerCountryAdapter = new ArrayAdapter<>(context, android.R.layout.simple_spinner_item, Common.ARR); spinerCountryAdapter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice); mSpnNewPlayerCountry.setAdapter(spinerCountryAdapter); mSpnNewPlayerCountry.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { mPlayerCountry = Common.ARR[position]; } @Override public void onNothingSelected(AdapterView<?> parent) { mPlayerCountry = Common.ARR[0]; } }); ArrayAdapter<Position.POSITISON> spinerPositionAdapter = new ArrayAdapter<Position.POSITISON>( context, android.R.layout.simple_spinner_item, Position.POSITISON.values()); spinerPositionAdapter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice); mSpnNewPlayerPosition.setAdapter(spinerPositionAdapter); mPlayerPosition = ((Position.POSITISON) mSpnNewPlayerPosition.getSelectedItem()); }
private void readGraph() { List<String> vals = new ArrayList<>(); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, vals); try { InputStream temp = getAssets().open("data.json"); StringBuilder builder = new StringBuilder(); byte[] buffer = new byte[1024]; while (temp.read(buffer, 0, 1024) != -1) { builder.append(new String(buffer)); } mGraph = JSONGraph.decodeGraph(new JSONObject(builder.toString())); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } for (Node n : mGraph.getNodeList()) { vals.add(n.getLabel()); } fromSpin.setAdapter(adapter); toSpin.setAdapter(adapter); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // call the superclass version setContentView(R.layout.flyingdistancecoursepage); // set the layout // get list of ids from database class ArrayList<?> idArray = FPCDatabase.getAirID(); // returning the array list from database class to then get values ids = new String[idArray.size()]; for (int i = 0; i < idArray.size(); i++) { ids[i] = (String) idArray.get( i); // taking every id from the arraylist in the database and adding it to the // string array ids } // Creating adapter with the string array ids and adding it to spinner ArrayAdapter<String> adapterAirports = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, ids); ArrayAdapter<CharSequence> adapterUnits = ArrayAdapter.createFromResource( this, R.array.distance_units, android.R.layout.simple_spinner_item); airportOne = (Spinner) findViewById(R.id.flyingdistancecourseDepartingAirportSpinner); airportTwo = (Spinner) findViewById(R.id.flyingdistanceDestinationAirportSpinner); distanceUnits = (Spinner) findViewById(R.id.flyingdistancecourseDistanceUnitSpinner); // Displays the string array for the spinners airportOne.setAdapter(adapterAirports); airportTwo.setAdapter(adapterAirports); distanceUnits.setAdapter(adapterUnits); airportOne.setOnItemSelectedListener(new airportOneSelectedListener()); airportTwo.setOnItemSelectedListener(new airportTwoSelectedListener()); distanceUnits.setOnItemSelectedListener(new distanceUnitSelectedListener()); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { v = inflater.inflate(R.layout.fragmentaddnotetabhost, container, false); // TextView tv = (TextView) v.findViewById(R.id.texttab); // tv.setText(this.getTag() + " Content"); Spinner spinnercours = (Spinner) v.findViewById(R.id.spinnercours); // Create an ArrayAdapter using the string array and a default spinner layout ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource( getActivity(), R.array.cours_array, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices appears adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner spinnercours.setAdapter(adapter); Spinner spinnersemestres = (Spinner) v.findViewById(R.id.spinnersemestres); // Create an ArrayAdapter using the string array and a default spinner layout ArrayAdapter<CharSequence> adaptersemestre = ArrayAdapter.createFromResource( getActivity(), R.array.cours_array, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices appears adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner spinnersemestres.setAdapter(adapter); Button button = (Button) v.findViewById(R.id.buttonaddnote); button.setOnClickListener(this); return v; }
private void initSpinners() { driveSpinner = (Spinner) findViewById(R.id.driveTypeSpinner); ArrayAdapter arrayadapter = ArrayAdapter.createFromResource( this, R.array.drive_type, android.R.layout.simple_spinner_item); arrayadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); driveSpinner.setAdapter(arrayadapter); wheelTypeSpinner = (Spinner) findViewById(R.id.wheelTypeSpinner); ArrayAdapter arrayAdapter1 = ArrayAdapter.createFromResource( this, R.array.wheel_type, android.R.layout.simple_spinner_item); arrayAdapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); wheelTypeSpinner.setAdapter(arrayAdapter1); wheelNumSpinner = (Spinner) findViewById(R.id.wheelNumSpinner); ArrayAdapter arrayAdapter2 = ArrayAdapter.createFromResource( this, R.array.num_wheels, android.R.layout.simple_spinner_item); arrayAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); wheelNumSpinner.setAdapter(arrayAdapter2); cimNumSpinner = (Spinner) findViewById(R.id.cimNumSpinner); ArrayAdapter arrayAdapter3 = ArrayAdapter.createFromResource( this, R.array.num_cims, android.R.layout.simple_spinner_item); arrayAdapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); cimNumSpinner.setAdapter(arrayAdapter3); highestPossibleStackSpinner = (Spinner) findViewById(R.id.highestStackSpinner); ArrayAdapter arrayAdapter4 = ArrayAdapter.createFromResource( this, R.array.highest_possible_stack, android.R.layout.simple_spinner_item); arrayAdapter4.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); highestPossibleStackSpinner.setAdapter(arrayAdapter4); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.payment); setTitle("Payment"); dm = new DatabaseManagement(this); payerSpinner = (Spinner) findViewById(R.id.payerSelector); payeeSpinner = (Spinner) findViewById(R.id.payeeSelector); moneyEditText = (EditText) findViewById(R.id.moneyInputEdit); enterButton = (Button) findViewById(R.id.paymentEnterButton); cancelButton = (Button) findViewById(R.id.paymentCancelButton); moneyEditText.setText("0"); persons = dm.getPersonNames(); adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, persons); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); payerSpinner.setAdapter(adapter); payerSpinner.setOnItemSelectedListener(new PayerSpinnerSelectedListener()); payerSpinner.setVisibility(View.VISIBLE); payeeSpinner.setAdapter(adapter); payeeSpinner.setOnItemSelectedListener(new PayeeSpinnerSelectedListener()); payeeSpinner.setVisibility(View.VISIBLE); enterButton.setOnClickListener(new EnterButtonClickListener()); cancelButton.setOnClickListener(new CancelButtonClickListener()); moneyEditText.setOnLongClickListener(new MoneyEditLongClick()); }
@Override public void initView() { // TODO Auto-generated method stub initBaseView("电台参数设置"); Btn_Left.setOnClickListener(this); Btn_Right.setBackgroundResource(R.drawable.btsure); Btn_Right.setOnClickListener(this); edit_senddelay = (EditText) findViewById(R.id.edit_senddelay); edit_recvdelay = (EditText) findViewById(R.id.edit_recedelay); sp_type = (Spinner) findViewById(R.id.sp_casttype); sp_power = (Spinner) findViewById(R.id.sp_casrpower); ArrayAdapter<String> typeadapter = new ArrayAdapter<String>(mContext, android.R.layout.simple_spinner_dropdown_item, Type); sp_type.setAdapter(typeadapter); ArrayAdapter<String> poweradapter = new ArrayAdapter<String>(mContext, android.R.layout.simple_spinner_dropdown_item, Power); sp_power.setAdapter(poweradapter); edit_senddelay.setText(sp.getString(senddeley, "")); edit_recvdelay.setText(sp.getString(recvdeley, "")); sp_power.setSelection(sp.getInt(powerindex, 0)); sp_type.setSelection(sp.getInt(typeindex, 0)); }
@SuppressLint("NewApi") void initData() { Display display = getActivity().getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int windowWidth = size.x; int _20dp = dpToPx(getActivity(), 20); int width = (windowWidth - _20dp) / 7; LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width, _20dp); monday.setLayoutParams(params); tuesday.setLayoutParams(params); wednesday.setLayoutParams(params); thursday.setLayoutParams(params); friday.setLayoutParams(params); saturday.setLayoutParams(params); sunday.setLayoutParams(params); semesterPosition = 0; yearlPosition = 0; yearUrl = urls[semesterPosition][yearlPosition]; ArrayAdapter<String> yearPickerAdapter = new ArrayAdapter<String>(getActivity(), R.layout.spinner_item, years); yearPickerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); yearPicker.setAdapter(yearPickerAdapter); ArrayAdapter<String> semesterPickerAdapter = new ArrayAdapter<String>(getActivity(), R.layout.spinner_item, semesters); semesterPickerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); semesterPicker.setAdapter(semesterPickerAdapter); new InitDataTask().execute(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_event); // get edit texts event_name = (EditText) findViewById(R.id.event_name); location = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextLocation); Start_Date = (EditText) findViewById(R.id.Start_Date); Start_Time = (EditText) findViewById(R.id.Start_Time); End_Date = (EditText) findViewById(R.id.End_Date); End_Time = (EditText) findViewById(R.id.End_Time); description = (EditText) findViewById(R.id.description); // AutoComplete TextView AutoCompleteTextView autoCompleteTextViewLocation = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextLocation); autoCompleteTextViewLocation.setAdapter( new GooglePlacesAutocompleteAdapter(this, R.layout.activity_add_event_location_list)); autoCompleteTextViewLocation.setOnItemClickListener(this); // spinnerCategory spinnerCategory = (Spinner) findViewById(R.id.category); spinnerCategory.setSelection(0); arrayAdapterCategory = ArrayAdapter.createFromResource(this, R.array.category_names, R.layout.spinner_item); spinnerCategory.setAdapter(arrayAdapterCategory); // spinnerType spinnerType = (Spinner) findViewById(R.id.type); spinnerType.setSelection(0); arrayAdapterType = ArrayAdapter.createFromResource(this, R.array.type_names, R.layout.spinner_item); spinnerType.setAdapter(arrayAdapterType); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); loadAdware(); imageSpinner = (Spinner) findViewById(R.id.spinner_image); ArrayAdapter adapter = ArrayAdapter.createFromResource( this, R.array.image_arrays, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); imageSpinner.setAdapter(adapter); // when an item is selected call the selectSensor method // imageSpinner.setOnItemSelectedListener(new ImageOnItemSelectedListener()); imageView = (ImageView) findViewById(R.id.imageView); scareButton = (Button) findViewById(R.id.button_scare); shareButton = (Button) findViewById(R.id.share_button); timeSpinner = (Spinner) findViewById(R.id.spinner_time); ArrayAdapter adapterTime = ArrayAdapter.createFromResource( this, R.array.time_arrays, android.R.layout.simple_spinner_item); adapterTime.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); timeSpinner.setAdapter(adapterTime); currentTime = 15; configureViews(); }
private void init() { ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(this, R.layout.item_spinner, list_xingzuo); ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(this, R.layout.item_spinner, list_age); ArrayAdapter<String> adapter3 = new ArrayAdapter<String>(this, R.layout.item_spinner, list_job); adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); adapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner_xingzuo.setAdapter(adapter1); spinner_age.setAdapter(adapter2); spinner_job.setAdapter(adapter3); rg_sex.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { // TODO Auto-generated method stub switch (checkedId) { case R.id.rb_sex_1: // 全部 sex = null; break; case R.id.rb_sex_2: // 男 sex = "1"; break; case R.id.rb_sex_3: // 女 sex = "2"; break; default: break; } } }); rg_time.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { // TODO Auto-generated method stub switch (checkedId) { case R.id.rb_time_1: // 15分钟 last_active_time = "1"; break; case R.id.rb_time_2: // 1小时 last_active_time = "2"; break; case R.id.rb_time_3: // 1天 last_active_time = "3"; break; case R.id.rb_time_4: // 3天 last_active_time = "4"; break; default: break; } } }); }
private void setAdapter(Spinner spinner, ArrayAdapter<String> adapter) { if (adapter.isEmpty()) { adapter.insert("No justification available", 0); spinner.setAdapter(adapter); } else { spinner.setAdapter(adapter); } }
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.dialog_add_availability, null); mStartDaySpinner = (Spinner) view.findViewById(R.id.start_day_of_week_spinner); ArrayAdapter<CharSequence> startAdapter = ArrayAdapter.createFromResource( getActivity(), R.array.days_of_week, android.R.layout.simple_spinner_item); startAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mStartDaySpinner.setAdapter(startAdapter); mEndDaySpinner = (Spinner) view.findViewById(R.id.end_day_of_week_spinner); ArrayAdapter<CharSequence> endAdapter = ArrayAdapter.createFromResource( getActivity(), R.array.days_of_week, android.R.layout.simple_spinner_item); endAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mEndDaySpinner.setAdapter(endAdapter); mStartTimeEdit = (EditText) view.findViewById(R.id.edit_start_time); mStartTimeEdit.setInputType(InputType.TYPE_NULL); mStartTimeEdit.setOnFocusChangeListener(mTimeFocusListener); mStartTimeEdit.setOnClickListener(mTimeClickListener); mEndTimeEdit = (EditText) view.findViewById(R.id.edit_end_time); mEndTimeEdit.setInputType(InputType.TYPE_NULL); mEndTimeEdit.setOnFocusChangeListener(mTimeFocusListener); mEndTimeEdit.setOnClickListener(mTimeClickListener); builder.setView(view); builder.setPositiveButton( R.string.dialog_add, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (mStartHour == null || mEndHour == null) { Toast.makeText(getActivity(), "Times not set!", Toast.LENGTH_SHORT).show(); return; } Availability avail = new Availability(); avail.startHour = mStartHour; avail.startMinute = mStartMinute; avail.endHour = mEndHour; avail.endMinute = mEndMinute; avail.startDay = mStartDaySpinner.getSelectedItemPosition(); avail.endDay = mEndDaySpinner.getSelectedItemPosition(); if (mListener != null) { mListener.onAvailabilityAdded(avail); } } }); builder.setNegativeButton( R.string.dialog_cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { AddAvailabilityDialog.this.getDialog().cancel(); } }); builder.setTitle(R.string.add_availability); return builder.create(); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_tela_cadastro, container, false); etNome = (EditText) rootView.findViewById(R.id.etNomeCompleto); etEmail = (EditText) rootView.findViewById(R.id.etEmail); etSenha = (EditText) rootView.findViewById(R.id.etSenha); etConfSenha = (EditText) rootView.findViewById(R.id.etConfSenha); etCPF = (EditText) rootView.findViewById(R.id.etCPF); etTelefone = (EditText) rootView.findViewById(R.id.etTelefone); etNumCartao = (EditText) rootView.findViewById(R.id.etNumCartaoCadastro); spTipoSocio = (Spinner) rootView.findViewById(R.id.spTipoSocio); ArrayAdapter<CharSequence> ar = ArrayAdapter.createFromResource( getActivity(), R.array.tipo_socio, android.R.layout.simple_list_item_1); ar.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); spTipoSocio.setAdapter(ar); spSexo = (Spinner) rootView.findViewById(R.id.spSexo); ArrayAdapter<CharSequence> ar2 = ArrayAdapter.createFromResource( getActivity(), R.array.sexo, android.R.layout.simple_list_item_1); ar.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); spSexo.setAdapter(ar2); btnConfirmar = (Button) rootView.findViewById(R.id.btnConfirmar); btnConfirmar.setOnClickListener(this); if (TelaCadastro.isEditar()) { etNome.setText(Socio.getSocioLogado().getNome()); etEmail.setText(Socio.getSocioLogado().getEmail()); etSenha.setText(Socio.getSocioLogado().getSenha()); etCPF.setText(Socio.getSocioLogado().getCpf()); etTelefone.setText(Socio.getSocioLogado().getTelefone()); etCPF.setEnabled(false); int selection = 0; if (Socio.getSocioLogado().getTipoSocio().equals("Master")) { selection = 0; } if (Socio.getSocioLogado().getTipoSocio().equals("Ouro")) { selection = 1; } if (Socio.getSocioLogado().getTipoSocio().equals("Prata")) { selection = 2; } if (Socio.getSocioLogado().getTipoSocio().equals("Patrimonial")) { selection = 3; } spTipoSocio.setSelection(selection); spTipoSocio.setEnabled(false); } return rootView; }
@Override public void readFromTask(Task task) { this.myTask = task; Metadata metadata = ProducteevDataService.getInstance().getTaskMetadata(myTask.getId()); if (metadata == null) metadata = ProducteevTask.newMetadata(); // Fill the dashboard-spinner and set the current dashboard long dashboardId = ProducteevUtilities.INSTANCE.getDefaultDashboard(); if (metadata.containsNonNullValue(ProducteevTask.DASHBOARD_ID)) dashboardId = metadata.getValue(ProducteevTask.DASHBOARD_ID); StoreObject[] dashboardsData = ProducteevDataService.getInstance().getDashboards(); dashboards = new ArrayList<ProducteevDashboard>(dashboardsData.length); ProducteevDashboard ownerDashboard = null; int dashboardSpinnerIndex = -1; int i = 0; for (i = 0; i < dashboardsData.length; i++) { ProducteevDashboard dashboard = new ProducteevDashboard(dashboardsData[i]); dashboards.add(dashboard); if (dashboard.getId() == dashboardId) { ownerDashboard = dashboard; dashboardSpinnerIndex = i; } } // dashboard to not sync as first spinner-entry dashboards.add( 0, new ProducteevDashboard( ProducteevUtilities.DASHBOARD_NO_SYNC, activity.getString(R.string.producteev_no_dashboard), null)); // dummy entry for adding a new dashboard dashboards.add( new ProducteevDashboard( ProducteevUtilities.DASHBOARD_CREATE, activity.getString(R.string.producteev_create_dashboard), null)); ArrayAdapter<ProducteevDashboard> dashAdapter = new ArrayAdapter<ProducteevDashboard>( activity, android.R.layout.simple_spinner_item, dashboards); dashAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); dashboardSelector.setAdapter(dashAdapter); dashboardSelector.setSelection(dashboardSpinnerIndex + 1); if (ownerDashboard == null || ownerDashboard.getId() == ProducteevUtilities.DASHBOARD_NO_SYNC || ownerDashboard.getId() == ProducteevUtilities.DASHBOARD_CREATE) { responsibleSelector.setEnabled(false); responsibleSelector.setAdapter(null); view.findViewById(R.id.producteev_TEA_task_assign_label).setVisibility(View.GONE); return; } refreshResponsibleSpinner(ownerDashboard.getUsers()); }
@Override protected View onCreateDialogView() { final View v = super.onCreateDialogView(); mSubtypeLocaleSpinner = (Spinner) v.findViewById(R.id.subtype_locale_spinner); mSubtypeLocaleSpinner.setAdapter(mProxy.getSubtypeLocaleAdapter()); mKeyboardLayoutSetSpinner = (Spinner) v.findViewById(R.id.keyboard_layout_set_spinner); mKeyboardLayoutSetSpinner.setAdapter(mProxy.getKeyboardLayoutSetAdapter()); return v; }
private void setUpSpinnerAdapters() { ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource( this, R.array.currencies, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); currency1Spinner.setAdapter(adapter); currency2Spinner.setAdapter(adapter); currency2Spinner.setSelection(1); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.wifi_rx_6620); if (WiFi.is11acSupported()) { mIsAdvancedMode = true; } mTvFcs = (TextView) findViewById(R.id.WiFi_FCS_Content); mTvRx = (TextView) findViewById(R.id.WiFi_Rx_Content); mTvPer = (TextView) findViewById(R.id.WiFi_PER_Content); mTvFcs.setText(R.string.wifi_empty); mTvRx.setText(R.string.wifi_empty); mTvPer.setText(R.string.wifi_empty); mBtnGo = (Button) findViewById(R.id.WiFi_Go_Rx); mBtnStop = (Button) findViewById(R.id.WiFi_Stop_Rx); mBtnGo.setOnClickListener(this); mBtnStop.setOnClickListener(this); mInitData = new long[2]; mChannel = new ChannelInfo(); mChannelSpinner = (Spinner) findViewById(R.id.WiFi_RX_Channel_Spinner); mChannelAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item); mChannelAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mChannelAdapter.clear(); for (int i = 1; i <= ChannelInfo.sChannels[0]; i++) { for (String s : mChannel.mFullChannelName) { if (s.startsWith("Channel " + ChannelInfo.sChannels[i] + " ")) { mChannelAdapter.add(s); break; } } } mChannelSpinner.setAdapter(mChannelAdapter); mChannelSpinner.setOnItemSelectedListener(mSpinnerListener); mBandwidthSpinner = (Spinner) findViewById(R.id.WiFi_Bandwidth_Spinner); // Bandwidth setings ArrayAdapter<String> bwAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item); bwAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); if (mIsAdvancedMode) { bwAdapter.add(mBandwidth[BW_INDX_ADVANCED]); } else { for (int i = 0; i < BW_INDX_ADVANCED; i++) { bwAdapter.add(mBandwidth[i]); } } mBandwidthSpinner.setAdapter(bwAdapter); mBandwidthSpinner.setOnItemSelectedListener(mSpinnerListener); mSpBwAdvCbw = (Spinner) findViewById(R.id.wifi_bandwidth_cbw_spn); mSpBwAdvDbw = (Spinner) findViewById(R.id.wifi_bandwidth_dbw_spn); mSpBwAdvPrimCh = (Spinner) findViewById(R.id.wifi_bandwidth_prim_ch_spn); setViewEnabled(true); initUiComponent(); }
@Override protected void findViews(View parent) { ArrayAdapter<SdlLanguage> adapter = AndroidUtils.createSpinnerAdapter(context, SdlLanguage.values()); spin_changeRegistration_language = (Spinner) view.findViewById(R.id.spin_changeRegistration_language); spin_changeRegistration_language.setAdapter(adapter); spin_changeRegistration_hmiLanguage = (Spinner) view.findViewById(R.id.spin_changeRegistration_hmiLanguage); spin_changeRegistration_hmiLanguage.setAdapter(adapter); }
public void setSpinners() { // data from local leftSpinner = (Spinner) pageView.findViewById(R.id.leftSpinner); leftSpinner.setAdapter(createArrayAdapter(R.array.search_parameters)); // data from server rightSpinner = (Spinner) pageView.findViewById(R.id.value_spinner); rightSpinner.setAdapter(createArrayAdapter(new ArrayList<String>())); leftSpinner.setOnItemSelectedListener(this); rightSpinner.setOnItemSelectedListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); // Register a Exception Handler Thread.setDefaultUncaughtExceptionHandler(new PocketHandler(this, ProductSearchForm.class)); requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.product_search_form); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.common_header); context = this; // setContentView(R.layout.product_search_form); Button btnProceed = (Button) findViewById(R.id.proceed_search); spnProductCategory = (Spinner) findViewById(R.id.search_item_category); spnProductType = (Spinner) findViewById(R.id.search_item_sub_category); // Populating Spinners // Fetching Array this.productCategory = ArrayAdapter.createFromResource( context, R.array.category, android.R.layout.simple_spinner_item); productCategory.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); this.productType = ArrayAdapter.createFromResource( context, R.array.Electronics, android.R.layout.simple_spinner_item); productType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Updating spinner adapters spnProductCategory.setAdapter(productCategory); spnProductType.setAdapter(productType); // Handling, Product Type Spinner, when Category is changed OnItemSelectedListener spinnerListener = new myOnItemSelectedListener(context, productCategory, spnProductType); spnProductCategory.setOnItemSelectedListener(spinnerListener); // Proceeding to next Activity btnProceed.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { if (validateForm()) { Bundle data = new Bundle(); data.putString("Category", (String) spnProductCategory.getSelectedItem()); data.putString("Type", (String) spnProductType.getSelectedItem()); Intent intent = new Intent(context, ProductList.class); intent.putExtras(data); startActivity(intent); } } }); }