public static final void initIncome(Activity activity, final Spinner spinner) { final ArrayAdapter arrayAdapter_center = new ArrayAdapter( activity, LAYOUT_CENTER, activity.getResources().getStringArray(R.array.income)); final ArrayAdapter arrayAdapter_left = new ArrayAdapter( activity, LAYOUT_LEFT, activity.getResources().getStringArray(R.array.income)); arrayAdapter_center.setDropDownViewResource(DROP_DOWN_LAYOUT); arrayAdapter_left.setDropDownViewResource(DROP_DOWN_LAYOUT); spinner.setAdapter(arrayAdapter_center); spinner.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position == 0) { spinner.setAdapter(arrayAdapter_center); } else { spinner.setAdapter(arrayAdapter_left); spinner.setSelection(position); } } @Override public void onNothingSelected(AdapterView<?> parent) {} }); }
// Adds a reminder to the displayed list of reminders. // Returns true if successfully added reminder, false if no reminders can // be added. static boolean addReminder( Activity activity, View.OnClickListener listener, ArrayList<LinearLayout> items, ArrayList<Integer> values, ArrayList<String> labels, int minutes) { if (items.size() >= MAX_REMINDERS) { return false; } LayoutInflater inflater = activity.getLayoutInflater(); LinearLayout parent = (LinearLayout) activity.findViewById(R.id.reminder_items_container); LinearLayout reminderItem = (LinearLayout) inflater.inflate(R.layout.edit_reminder_item, null); parent.addView(reminderItem); Spinner spinner = (Spinner) reminderItem.findViewById(R.id.reminder_value); Resources res = activity.getResources(); spinner.setPrompt(res.getString(R.string.reminders_title)); int resource = android.R.layout.simple_spinner_item; ArrayAdapter<String> adapter = new ArrayAdapter<String>(activity, resource, labels); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); ImageButton reminderRemoveButton; reminderRemoveButton = (ImageButton) reminderItem.findViewById(R.id.reminder_remove); reminderRemoveButton.setOnClickListener(listener); int index = findMinutesInReminderList(values, minutes); spinner.setSelection(index); items.add(reminderItem); return true; }
@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() { searchField = (EditText) findViewById(R.id.search); clear = (ImageButton) findViewById(R.id.clear); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); genreSpinner = (AppCompatSpinner) findViewById(R.id.genre); sortSpinner = (AppCompatSpinner) findViewById(R.id.sort); ratingSpinner = (AppCompatSpinner) findViewById(R.id.rating); searchButton = (FloatingActionButton) findViewById(R.id.search_button); qualityRG = (RadioGroup) findViewById(R.id.quality_rg); orderRG = (RadioGroup) findViewById(R.id.order_rg); setSupportActionBar(toolbar); //noinspection ConstantConditions getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP); ArrayAdapter<CharSequence> genreAdapter = ArrayAdapter.createFromResource(this, R.array.genre_name, R.layout.dropdown_display); genreAdapter.setDropDownViewResource(R.layout.dropdown_item); genreSpinner.setAdapter(genreAdapter); ArrayAdapter<CharSequence> sortAdapter = ArrayAdapter.createFromResource(this, R.array.sort_name, R.layout.dropdown_display); sortAdapter.setDropDownViewResource(R.layout.dropdown_item); sortSpinner.setAdapter(sortAdapter); ArrayAdapter<CharSequence> ratingAdapter = ArrayAdapter.createFromResource(this, R.array.rating_name, R.layout.dropdown_display); ratingAdapter.setDropDownViewResource(R.layout.dropdown_item); ratingSpinner.setAdapter(ratingAdapter); imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); }
@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 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); }
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); }
@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(); }
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); } }
@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); }
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 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; } } }); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (savedInstanceState != null && AccountManager.getInstance() == null) { return null; } View rootView = inflater.inflate(R.layout.fragment_edit, container, false); mContainer = (LinearLayout) rootView.findViewById(android.R.id.list); View footer = inflater.inflate(R.layout.add_field, container, false); footer.setOnClickListener(this); mNameEditText = (EditText) rootView.findViewById(android.R.id.title); mScroll = (PbScrollView) rootView.findViewById(R.id.scroll); mNameEditText.addTextChangedListener(this); mToolbarContainer = rootView.findViewById(R.id.toolbar_container); if (mToolbarContainer != null) { mHeader = rootView.findViewById(R.id.header); mScroll.setPbScrollListener(this); } setupToolbar(rootView); mCategorySpinner = (Spinner) rootView.findViewById(R.id.category); if (mAccountId >= 0) { mDummyAccount = AccountManager.getInstance().getAccountById(mAccountId).clone(); mName = mDummyAccount.getAccountName(); } else { mDummyAccount = getEntryList(); mName = ""; } int spinnerLayout = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN ? android.R.layout.simple_spinner_dropdown_item : R.layout.spinner_dropdown; mTypeAdapter = ArrayAdapter.createFromResource( getActivity(), R.array.field_types, android.R.layout.simple_spinner_dropdown_item); mTypeAdapter.setDropDownViewResource(spinnerLayout); mEntries = new ArrayList<>(); mDeleteView = (ImageView) inflater.inflate(R.layout.delete_field, container, false); int pos = 0; for (Entry e : mDummyAccount.getEntryList()) { onAddField(e, pos++); } mContainer.addView(footer); mContainer.addView(mDeleteView); mDeleteView.setOnDragListener(mDragListener); ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>( getActivity(), android.R.layout.simple_spinner_dropdown_item, Application.getSortedCategoryNames()); spinnerAdapter.setDropDownViewResource(spinnerLayout); mCategorySpinner.setAdapter(spinnerAdapter); mCategorySpinner.setOnItemSelectedListener(this); View top = rootView.findViewById(R.id.top_frame); if (top != null) { top.setOnClickListener(this); } return rootView; }
@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 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 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); } } }); }
private void initSpinners() { sex = (Spinner) findViewById(R.id.spinnerSex); ArrayAdapter<CharSequence> adapterSex = ArrayAdapter.createFromResource( this, R.array.sex_array, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices appears adapterSex.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner sex.setAdapter(adapterSex); sex.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { sexTyp = parent.getItemAtPosition(position).toString(); selectImage(); } @Override public void onNothingSelected(AdapterView<?> parent) {} }); typ = (Spinner) findViewById(R.id.spinnerCharacterTyp); ArrayAdapter<CharSequence> adapterTyp = ArrayAdapter.createFromResource( this, R.array.typ_array, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices appears adapterTyp.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner typ.setAdapter(adapterTyp); typ.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { weaponTyp = parent.getItemAtPosition(position).toString(); weaponNr = getWeaponNr(weaponTyp); selectShowSchild(); selectImage(); schild.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { selectImage(); } }); } @Override public void onNothingSelected(AdapterView<?> parent) {} }); }
private void populateSpinners() { ArrayAdapter<CharSequence> fAdapter; fAdapter = ArrayAdapter.createFromResource( this, R.array.update_freq_options, android.R.layout.simple_spinner_item); int spinner_dd_item = android.R.layout.simple_spinner_dropdown_item; fAdapter.setDropDownViewResource(spinner_dd_item); updateFreqSpinner.setAdapter(fAdapter); ArrayAdapter<CharSequence> mAdapter; mAdapter = ArrayAdapter.createFromResource( this, R.array.magnitude_options, android.R.layout.simple_spinner_item); mAdapter.setDropDownViewResource(spinner_dd_item); magnitudeSpinner.setAdapter(mAdapter); }
private void initializeSpinners(final View rootView) { final ArrayAdapter<String> adapter = new ArrayAdapter<String>( getActivity(), android.R.layout.simple_spinner_item, RESOLUTION_NAMES); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); resolutionSp = (Spinner) rootView.findViewById(R.id.sp_resolution); resolutionSp.setAdapter(adapter); final ArrayAdapter<String> adapter2 = new ArrayAdapter<String>( getActivity(), android.R.layout.simple_spinner_item, QUALITY_NAMES); adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); qualitySp = (Spinner) rootView.findViewById(R.id.sp_quality); qualitySp.setAdapter(adapter2); }
@Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.repoconfig); Spinner repositoriesSpinner = (Spinner) findViewById(R.id.repositories); ArrayAdapter<CharSequence> repositories = ArrayAdapter.createFromResource( this, R.array.repositories, android.R.layout.simple_spinner_item); repositories.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); repositoriesSpinner.setAdapter(repositories); repositoriesSpinner.setSelection(repositories.getPosition(MinistroService.getRepository(this))); repositoriesSpinner.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { Toast.makeText( parent.getContext(), getResources() .getString( R.string.ministro_repository_msg, parent.getItemAtPosition(pos).toString()), Toast.LENGTH_SHORT) .show(); MinistroService.setRepository( MinistroConfigActivity.this, parent.getItemAtPosition(pos).toString()); } public void onNothingSelected(AdapterView<?> arg0) {} }); Spinner checkFrequencySpinner = (Spinner) findViewById(R.id.check_frequency); ArrayAdapter<CharSequence> checkFrequency = ArrayAdapter.createFromResource( this, R.array.check_frequency, android.R.layout.simple_spinner_item); checkFrequency.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); checkFrequencySpinner.setAdapter(checkFrequency); checkFrequencySpinner.setSelection( checkFrequency.getPosition(MinistroService.getCheckFrequency(this).toString())); checkFrequencySpinner.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { MinistroService.setCheckFrequency( MinistroConfigActivity.this, Long.parseLong(parent.getItemAtPosition(pos).toString())); } public void onNothingSelected(AdapterView<?> arg0) {} }); super.onCreate(savedInstanceState); }
private void setupProjectSpinner() { Cursor projectCursor = getContentResolver() .query( ProjectProvider.Projects.CONTENT_URI, cProjectProjection, ProjectProvider.Projects.DELETED + " = 0", null, ProjectProvider.Projects.NAME + " ASC"); int arraySize = projectCursor.getCount() + 1; mProjectIds = new long[arraySize]; mProjectIds[0] = 0; mProjectNames = new String[arraySize]; mProjectNames[0] = getText(R.string.none_empty).toString(); for (int i = 1; i < arraySize; i++) { projectCursor.moveToNext(); mProjectIds[i] = projectCursor.getLong(0); mProjectNames[i] = projectCursor.getString(1); } projectCursor.close(); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mProjectNames); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mProjectSpinner.setAdapter(adapter); }
private void initUserAdapter(List<String> users) { ArrayAdapter<String> adapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item); for (String s : users) adapter.add(s); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // spUsername.setAdapter(adapter); }
private ArrayAdapter<String> getArrayAdapter(String[] arr) { ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, arr); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); adapter.sort(comparator); return adapter; }
/** * Creates the select parking options page. * * @param savedInstanceState Saved instance state */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_select_parking_options); // Retrieve screen inputs whereToLabel_ = (TextView) findViewById(R.id.whereToLabel); whereToSpinner_ = (Spinner) findViewById(R.id.whereToList); findParkingButton_ = (Button) findViewById(R.id.findParkingButton); // Populate the Where To? spinner - reuse TOC text view layout List<Building> buildingList = Session.getCurrentBuildings(); int numBuildings = buildingList.size(); String[] buildingNames = new String[numBuildings]; for (int i = 0; i < numBuildings; i++) { buildingNames[i] = buildingList.get(i).getName(); } ArrayAdapter whereToAdapter = new ArrayAdapter<String>(this, R.layout.activity_toclistview, buildingNames); // Specify dropdown layout whereToAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item); // Apply adapter to spinner whereToSpinner_.setAdapter(whereToAdapter); }
@Override protected void onPostExecute(String sResponse) { try { if (dialog.isShowing()) { dialog.dismiss(); firstexecution = 1989; ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>( TechnicienActivity.this, android.R.layout.simple_spinner_item, listclt); dataAdapter.setDropDownViewResource(android.R.layout.select_dialog_singlechoice); // facturespinner.setAdapter(dataAdapter); addItemsOnSpinner(services, 3); // ArrayAdapter<String> dataAdapter = new // ArrayAdapter<String>(TechnicienActivity.this,android.R.layout.simple_dropdown_item_1line, listclt); clients.setAdapter(dataAdapter); clients.setThreshold(1); clients.setTextColor(Color.RED); for (BordreauIntervention b : myoffine.LoadInterventions("")) { Log.e(">> interv ", b.toString()); } // wakelock.release(); } } catch (Exception e) { Toast.makeText(getApplicationContext(), e.getMessage() + " << ", Toast.LENGTH_LONG).show(); Log.e(e.getClass().getName(), e.getMessage() + " << ", e); } }
@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()); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.settings); saveBoton = (Button) findViewById(R.id.button1); cancelBoton = (Button) findViewById(R.id.button2); et = (EditText) findViewById(R.id.editText1); prefs = getSharedPreferences("preferences", Context.MODE_PRIVATE); et.setText(String.valueOf(prefs.getLong("rad", 100))); spin = (Spinner) findViewById(R.id.spinner1); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.units, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spin.setAdapter(adapter); spin.setOnItemSelectedListener(new MyOnItemSelectedListener()); saveBoton.setOnClickListener(new OnClickSaveListener()); cancelBoton.setOnClickListener(new OnClickCancelListener()); }