Java Code Examples for android.widget.AdapterView#setAdapter()
The following examples show how to use
android.widget.AdapterView#setAdapter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseAdapterConverter.java From UniversalAdapter with Apache License 2.0 | 6 votes |
/** * Binds this adapter to the given {@link AdapterView}, setting it as its adapter. This should be done by * construction or immediately after, before this adapter is used. This mechanism sets this class as the view's * adapter and permits certain functionality such as click events. Without it, this class will still function as * a normal {@link BaseAdapter}, but additional functionality may not work. Ignore this step at your own risk. * * @param adapterView The {@link AdapterView} to bind to. */ public void bindToAdapterView(AdapterView<? super BaseAdapter> adapterView) { if (adapterView != null) { adapterView.setAdapter(this); // Spinners don't like on item click listeners. // We will still delegate calls to it since you're clicking on an item to select it... if (!(adapterView instanceof Spinner)) { adapterView.setOnItemClickListener(internalItemClickListener); } else { adapterView.setOnItemSelectedListener(internalItemSelectedListener); } adapterView.setOnItemLongClickListener(internalLongClickListener); } }
Example 2
Source File: MultiChoiceAdapterHelperBase.java From MultiChoiceAdapter with Apache License 2.0 | 5 votes |
public void setAdapterView(AdapterView<? super BaseAdapter> adapterView) { this.adapterView = adapterView; checkActivity(); adapterView.setOnItemLongClickListener(this); adapterView.setOnItemClickListener(this); adapterView.setAdapter(owner); parseAttrs(); if (!checkedItems.isEmpty()) { startActionMode(); onItemSelectedStateChanged(); } }
Example 3
Source File: PXHierarchyListener.java From pixate-freestyle-android with Apache License 2.0 | 5 votes |
@SuppressWarnings({ "rawtypes", "unchecked" }) private static void setAdapterProxy(final AdapterView adapterView) { Adapter adapter = adapterView.getAdapter(); if (adapter == null || Proxy.isProxyClass(adapter.getClass())) { // Thou shalt not Proxy a Proxy! return; } if (adapterView instanceof ExpandableListView) { // FIXME - Right now, skip the support for ExpandableListView. // This class throws exceptions on setAdapter(Adapter), and requires // a special adapter that only works with it.... Lame API break! return; } // Collect the Adapter sub-interfaces that we // would like to proxy. List<Class<?>> interfaces = new ArrayList<Class<?>>(4); interfaces.add(Adapter.class); if (adapter instanceof ListAdapter) { interfaces.add(ListAdapter.class); } if (adapter instanceof WrapperListAdapter) { interfaces.add(WrapperListAdapter.class); } if (adapter instanceof SpinnerAdapter) { interfaces.add(SpinnerAdapter.class); } // Create a proxy for the adapter to intercept // the 'getView' Adapter newAdapter = (Adapter) PXAdapterInvocationHandler.newInstance(adapterView, interfaces.toArray(new Class<?>[interfaces.size()])); // Set the proxy as the adapter adapterView.setAdapter(newAdapter); }
Example 4
Source File: EntitySelectActivity.java From commcare-android with Apache License 2.0 | 5 votes |
private void setupUIFromAdapter(AdapterView view) { view.setAdapter(adapter); if (view instanceof ListView) { EntitySelectViewSetup.setupDivider(this, (ListView)view, shortSelect.usesEntityTileView()); } findViewById(R.id.entity_select_loading).setVisibility(View.GONE); entitySelectSearchUI.setSearchBannerState(); }
Example 5
Source File: EntitySelectActivity.java From commcare-android with Apache License 2.0 | 4 votes |
@Override public void deliverLoadResult(List<Entity<TreeReference>> entities, List<TreeReference> references, NodeEntityFactory factory, int focusTargetIndex) { loader = null; AdapterView visibleView; if (shortSelect.shouldBeLaidOutInGrid()) { visibleView = ((GridView)this.findViewById(R.id.screen_entity_select_grid)); } else { ListView listView = this.findViewById(R.id.screen_entity_select_list); EntitySelectViewSetup.setupDivider(this, listView, shortSelect.usesEntityTileView()); visibleView = listView; } adapter = new EntityListAdapter(this, shortSelect, references, entities, factory, hideActionsFromEntityList, shortSelect.getCustomActions(evalContext()), inAwesomeMode); visibleView.setAdapter(adapter); adapter.registerDataSetObserver(this.mListStateObserver); containerFragment.setData(adapter); if (entitySelectSearchUI != null) { entitySelectSearchUI.restoreSearchString(); } // Pre-select entity if one was provided in original intent if (!resuming && !mNoDetailMode && inAwesomeMode && this.getIntent().hasExtra(EXTRA_ENTITY_KEY)) { TreeReference entity = selectDatum.getEntityFromID(evalContext(), this.getIntent().getStringExtra(EXTRA_ENTITY_KEY)); if (entity != null) { displayReferenceAwesome(entity, adapter.getPosition(entity)); updateSelectedItem(entity, true); } } findViewById(R.id.entity_select_loading).setVisibility(View.GONE); if (adapter != null) { // filter by additional session data (search string, callout result data) // Relevant when user navigates so far forward in the session that // the entity list needs to be reloaded upon returning to it restoreAdapterStateFromSession(); } if (inAwesomeMode) { updateSelectedItem(true); } else if (focusTargetIndex != -1) { visibleView.setSelection(focusTargetIndex); } refreshTimer.start(this); if (locationChangedWhileLoading) { Log.i("HereFunctionHandler", "location changed while reloading"); locationChangedWhileLoading = false; loadEntities(); } }
Example 6
Source File: ItemViewHelper.java From JianshuApp with GNU General Public License v3.0 | 4 votes |
public ItemViewHelper setAdapter(int viewId, Adapter adapter) { AdapterView view = this.getView(viewId); view.setAdapter(adapter); return this; }
Example 7
Source File: BaseViewHolder.java From BaseProject with Apache License 2.0 | 3 votes |
/** * Sets the adapter of a adapter view. * * @param viewId The view id. * @param adapter The adapter; * @return The BaseViewHolder for chaining. */ @SuppressWarnings("unchecked") public BaseViewHolder setAdapter(@IdRes int viewId, Adapter adapter) { AdapterView view = getView(viewId); view.setAdapter(adapter); return this; }
Example 8
Source File: BaseViewHolder.java From imsdk-android with MIT License | 3 votes |
/** * Sets the adapter of a adapter view. * * @param viewId The view id. * @param adapter The adapter; * @return The BaseViewHolder for chaining. */ @SuppressWarnings("unchecked") public BaseViewHolder setAdapter(@IdRes int viewId, Adapter adapter) { AdapterView view = getView(viewId); view.setAdapter(adapter); return this; }
Example 9
Source File: BaseViewHolder.java From AndroidBase with Apache License 2.0 | 2 votes |
/** * Sets the adapter of a adapter view. * * @param viewId The view id. * @param adapter The adapter; * @return The BaseViewHolder for chaining. */ public BaseViewHolder setAdapter(int viewId, Adapter adapter) { AdapterView view = getView(viewId); view.setAdapter(adapter); return this; }
Example 10
Source File: BaseAdapterHelper.java From base-adapter-helper-recyclerview with Apache License 2.0 | 2 votes |
/** * Sets the adapter of a adapter view. * * @param viewId The view id. * @param adapter The adapter; * @return The BaseAdapterHelper for chaining. */ public BaseAdapterHelper setAdapter(int viewId, Adapter adapter) { AdapterView view = retrieveView(viewId); view.setAdapter(adapter); return this; }
Example 11
Source File: BaseViewHolder.java From NIM_Android_UIKit with MIT License | 2 votes |
/** * Sets the adapter of a adapter view. * * @param viewId The view id. * @param adapter The adapter; * @return The BaseViewHolder for chaining. */ public BaseViewHolder setAdapter(int viewId, Adapter adapter) { AdapterView view = getView(viewId); view.setAdapter(adapter); return this; }
Example 12
Source File: BaseAdapterHelper.java From AndroidBase with Apache License 2.0 | 2 votes |
/** * Sets the adapter of a adapter view. * * @param viewId * The view id. * @param adapter * The adapter; * @return The BaseAdapterHelper for chaining. */ public BaseAdapterHelper setAdapter(int viewId, Adapter adapter) { AdapterView view = retrieveView(viewId); view.setAdapter(adapter); return this; }
Example 13
Source File: BaseAdapterHelper.java From BigApp_WordPress_Android with Apache License 2.0 | 2 votes |
/** * Sets the adapter of a adapter view. * * @param viewId The view id. * @param adapter The adapter; * @return The BaseAdapterHelper for chaining. */ public BaseAdapterHelper setAdapter(int viewId, Adapter adapter) { AdapterView view = retrieveView(viewId); view.setAdapter(adapter); return this; }
Example 14
Source File: BaseViewHolder.java From basic-adapter with MIT License | 2 votes |
/** * Sets the adapter of a adapter view. * * @param viewId The view id. * @param adapter The adapter; * @return The BaseViewHolder for chaining. */ public BaseViewHolder setAdapter(int viewId, Adapter adapter) { AdapterView view = getView(viewId); view.setAdapter(adapter); return this; }
Example 15
Source File: BaseAdapterHelper.java From BigApp_Discuz_Android with Apache License 2.0 | 2 votes |
/** * Sets the adapter of a adapter view. * * @param viewId The view id. * @param adapter The adapter; * @return The BaseAdapterHelper for chaining. */ public BaseAdapterHelper setAdapter(int viewId, Adapter adapter) { AdapterView view = retrieveView(viewId); view.setAdapter(adapter); return this; }
Example 16
Source File: BaseViewHolder.java From JD-Test with Apache License 2.0 | 2 votes |
/** * Sets the adapter of a adapter view. * * @param viewId The view id. * @param adapter The adapter; * @return The BaseViewHolder for chaining. */ public BaseViewHolder setAdapter(int viewId, Adapter adapter) { AdapterView view = getView(viewId); view.setAdapter(adapter); return this; }
Example 17
Source File: BaseViewHolder.java From GoogleVR with Apache License 2.0 | 2 votes |
/** * Sets the adapter of a adapter view. * * @param viewId The view id. * @param adapter The adapter; * @return The BaseViewHolder for chaining. */ public BaseViewHolder setAdapter(int viewId, Adapter adapter) { AdapterView view = getView(viewId); view.setAdapter(adapter); return this; }
Example 18
Source File: BaseViewHolder.java From demo4Fish with MIT License | 2 votes |
/** * Sets the adapter of a adapter view. * * @param viewId The view id. * @param adapter The adapter; * @return The BaseViewHolder for chaining. */ public BaseViewHolder setAdapter(int viewId, Adapter adapter) { AdapterView view = getView(viewId); view.setAdapter(adapter); return this; }