List of usage examples for android.widget ArrayAdapter addAll
public void addAll(T... items)
From source file:Main.java
public static void arrayAdapterAddAll(ArrayAdapter<String> adapter, ArrayList<String> toAdd) { adapter.addAll(toAdd); }
From source file:Main.java
public static void getRingtonesDialog(Activity activity, Collection<String> items, int selected, DialogInterface.OnClickListener itemClickListener, DialogInterface.OnClickListener okClickListener, final DialogInterface.OnClickListener cancelClickListener) { AlertDialog.Builder builderSingle = new AlertDialog.Builder(activity); builderSingle.setTitle("Select Ringtone"); final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(activity, android.R.layout.select_dialog_singlechoice); arrayAdapter.addAll(items); builderSingle.setNegativeButton(android.R.string.cancel, cancelClickListener); builderSingle.setPositiveButton(android.R.string.ok, okClickListener); builderSingle.setSingleChoiceItems(arrayAdapter, selected, itemClickListener); builderSingle.setCancelable(false);/*from w ww .j a v a 2s . c o m*/ builderSingle.show(); }
From source file:net.kjmaster.cookiemom.summary.SummaryFragment.java
@AfterViews void afterViews() { // Create an ArrayAdapter using the string array and a default spinner layout // ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), // R.array.tab_names, android.R.layout.simple_spinner_item); ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item); adapter.addAll(tags); // 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 spinner.setAdapter(adapter);//from w w w .ja va 2 s. co m FragmentTransaction fragmentTransaction = getActivity().getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.graph_content, SummaryCookiesFragment_.builder().build(), tags[0]); fragmentTransaction.commit(); }
From source file:com.events.events.features.welcome.SelectCityFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_select_city, container, false); ButterKnife.bind(this, view); ArrayAdapter<String> cityAdapter = new ArrayAdapter<>(getActivity(), R.layout.spinner_item); cityAdapter.addAll(getResources().getStringArray(R.array.cities)); mSelectCitySpinner.setAdapter(cityAdapter); Drawable.ConstantState constantState = mSelectCitySpinner.getBackground().getConstantState(); if (constantState != null) { Drawable spinnerDrawable = constantState.newDrawable(); spinnerDrawable.setColorFilter(ContextCompat.getColor(getActivity(), android.R.color.white), PorterDuff.Mode.SRC_ATOP); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { mSelectCitySpinner.setBackground(spinnerDrawable); } else {/* w w w. j a v a 2 s . c om*/ //noinspection deprecation mSelectCitySpinner.setBackgroundDrawable(spinnerDrawable); } } mSelectCitySpinner.setTitle(getActivity().getResources().getString(R.string.select_city_spinner_title)); mSelectCitySpinner .setPositiveButton(getActivity().getResources().getString(R.string.select_city_spinner_close)); mContinueButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AnimUtils.animteViewsOut(new ViewPropertyAnimatorListener() { @Override public void onAnimationStart(View view) { } @Override public void onAnimationEnd(View view) { ((WelcomeActivity) getActivity()).nextSlide(); } @Override public void onAnimationCancel(View view) { } }, mContinueButton, mSelectCitySpinner, mSelectCityTitle, mSelectCityImage); } }); AnimUtils.alphaZero(mSelectCityImage, mSelectCitySpinner, mSelectCityTitle, mContinueButton); return view; }
From source file:com.velo.cityon.fragment.SwipeRefreshListFragmentFragment.java
private void onRefreshComplete(List<Posting> result) { Log.i(LOG_TAG, name + " : onRefreshComplete"); // Remove all items from the ListAdapter, and then replace them with the new items ArrayAdapter<Posting> adapter = (ArrayAdapter<Posting>) getListAdapter(); adapter.addAll(result); setRefreshing(false);/* www .j a va 2s. c om*/ }
From source file:com.google.android.apps.mytracks.util.Api11Adapter.java
@Override public <T> void addAllToArrayAdapter(ArrayAdapter<T> arrayAdapter, List<T> items) { arrayAdapter.addAll(items); }
From source file:ca.farrelltonsolar.classic.ChargeControllers.java
public void load(ArrayAdapter adapter) { synchronized (devices) { adapter.addAll(devices); } }
From source file:com.ibm.msg.android.NewConnection.java
/** * @see android.app.Activity#onCreate(android.os.Bundle) *///from ww w . j ava2s . c o m @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_connection); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1); adapter.addAll(readHosts()); AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.serverURI); textView.setAdapter(adapter); //load auto compete options }
From source file:com.hardcopy.vcontroller.fragments.ControllerFragment.java
private void addAutoCompleteAdapter() { ArrayAdapter<String> adapter = new ArrayAdapter<String>(mContext, android.R.layout.simple_list_item_1); adapter.addAll(Utils.getInstance(mContext).readSuggestion(Utils.AUTO_COMPLETE_TOPIC)); AutoCompleteTextView textView = (AutoCompleteTextView) mRootView.findViewById(R.id.topic); textView.setAdapter(adapter);/*from ww w .j a va 2 s .c o m*/ }
From source file:com.tassadar.multirommgr.installfragment.InstallCard.java
@Override public View getCardContent(Context context) { m_view = LayoutInflater.from(context).inflate(R.layout.install_card, null); Resources res = m_view.getResources(); CheckBox b = (CheckBox) m_view.findViewById(R.id.install_multirom); b.setText(res.getString(R.string.install_multirom, m_manifest.getMultiromVersion())); b.setChecked(m_manifest.hasMultiromUpdate()); b.setOnCheckedChangeListener(this); b = (CheckBox) m_view.findViewById(R.id.install_recovery); if (m_manifest.getRecoveryFile() != null) { final Date rec_date = m_manifest.getRecoveryVersion(); final String recovery_ver = Recovery.DISPLAY_FMT.format(rec_date); b.setText(res.getString(R.string.install_recovery, recovery_ver)); b.setChecked(m_manifest.hasRecoveryUpdate()); b.setOnCheckedChangeListener(this); // Force user to install recovery if not yet installed - it is needed to flash ZIPs if (m_manifest.hasRecoveryUpdate() && m_forceRecovery) { b.append(Html.fromHtml(res.getString(R.string.required))); b.setClickable(false);//from ww w . jav a2 s. c om } } else { b.setChecked(false); b.setVisibility(View.GONE); } ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_dropdown_item); adapter.addAll(m_manifest.getKernels().keySet()); Spinner s = (Spinner) m_view.findViewById(R.id.kernel_options); s.setAdapter(adapter); s.setEnabled(false); s.setSelection(getDefaultKernel()); b = (CheckBox) m_view.findViewById(R.id.install_kernel); b.setOnCheckedChangeListener(this); b.setEnabled(!adapter.isEmpty()); b.setChecked(!adapter.isEmpty() && m_manifest.hasKernelUpdate()); Button install_btn = (Button) m_view.findViewById(R.id.install_btn); install_btn.setOnClickListener(this); ImageButton changelog_btn = (ImageButton) m_view.findViewById(R.id.changelog_btn); if (m_manifest.getChangelogs() == null || m_manifest.getChangelogs().length == 0) changelog_btn.setVisibility(View.GONE); else changelog_btn.setOnClickListener(this); if (m_savedState != null) restoreInstanceState(); enableInstallBtn(); return m_view; }