This class can be used by external clients of SimpleCursorAdapter
to bind values fom the Cursor to views.
You should use this class to bind values from the Cursor to views
that are not directly supported by SimpleCursorAdapter or to
change the way binding occurs for views supported by
SimpleCursorAdapter.
boolean setViewValue (View view,
Cursor cursor,
int columnIndex)
Binds the Cursor column defined by the specified index to the specified view.
When binding is handled by this ViewBinder, this method must return true.
If this method returns false, SimpleCursorAdapter will attempts to handle
the binding on its own.
Parameters
view
View: the view to bind the data to
cursor
Cursor: the cursor to get the data from
columnIndex
int: the column at which the data can be found in the cursor
Returns
boolean
true if the data was bound to the view, false otherwise
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# SimpleCursorAdapter.ViewBinder\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \nbelongs to Maven artifact com.android.support:cursoradapter:28.0.0-alpha1 \n\nSimpleCursorAdapter.ViewBinder\n==============================\n\n| This package is part of the Android [support library](/topic/libraries/support-library) which is no longer maintained. The support library has been superseded by [AndroidX](/jetpack/androidx) which is part of [Jetpack](/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider [migrating](/jetpack/androidx/migrate) existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library [class\n| mappings](/jetpack/androidx/migrate/class-mappings).\n\n\n`\npublic\nstatic\n\n\ninterface\nSimpleCursorAdapter.ViewBinder\n`\n\n\n`\n\n\n`\n\n|----------------------------------------------------------|\n| android.support.v4.widget.SimpleCursorAdapter.ViewBinder |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nThis class can be used by external clients of SimpleCursorAdapter\nto bind values fom the Cursor to views.\n\nYou should use this class to bind values from the Cursor to views\nthat are not directly supported by SimpleCursorAdapter or to\nchange the way binding occurs for views supported by\nSimpleCursorAdapter. \n**See also:**\n\n- [bindView(View, Context, Cursor)](/reference/android/support/v4/widget/SimpleCursorAdapter#bindView(android.view.View, android.content.Context, android.database.Cursor))\n- [setViewImage(ImageView, String)](/reference/android/support/v4/widget/SimpleCursorAdapter#setViewImage(android.widget.ImageView, java.lang.String))\n- [setViewText(TextView, String)](/reference/android/support/v4/widget/SimpleCursorAdapter#setViewText(android.widget.TextView, java.lang.String))\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[setViewValue](/reference/android/support/v4/widget/SimpleCursorAdapter.ViewBinder#setViewValue(android.view.View, android.database.Cursor, int))`(`[View](https://developer.android.com/reference/android/view/View.html)` view, `[Cursor](https://developer.android.com/reference/android/database/Cursor.html)` cursor, int columnIndex) ` Binds the Cursor column defined by the specified index to the specified view. |\n\nPublic methods\n--------------\n\n### setViewValue\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nboolean setViewValue (View view, \n Cursor cursor, \n int columnIndex)\n```\n\nBinds the Cursor column defined by the specified index to the specified view.\n\nWhen binding is handled by this ViewBinder, this method must return true.\nIf this method returns false, SimpleCursorAdapter will attempts to handle\nthe binding on its own.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------------|-----------------------------------------------------------------------|\n| `view` | `View`: the view to bind the data to \u003cbr /\u003e |\n| `cursor` | `Cursor`: the cursor to get the data from \u003cbr /\u003e |\n| `columnIndex` | `int`: the column at which the data can be found in the cursor \u003cbr /\u003e |\n\n| Returns ||\n|-----------|----------------------------------------------------------------|\n| `boolean` | true if the data was bound to the view, false otherwise \u003cbr /\u003e |\n\n-\n\n Interfaces\n ----------\n\n - [DrawerLayout.DrawerListener](/reference/android/support/v4/widget/DrawerLayout.DrawerListener)\n - [NestedScrollView.OnScrollChangeListener](/reference/android/support/v4/widget/NestedScrollView.OnScrollChangeListener)\n - [SimpleCursorAdapter.CursorToStringConverter](/reference/android/support/v4/widget/SimpleCursorAdapter.CursorToStringConverter)\n - [SimpleCursorAdapter.ViewBinder](/reference/android/support/v4/widget/SimpleCursorAdapter.ViewBinder)\n - [SlidingPaneLayout.PanelSlideListener](/reference/android/support/v4/widget/SlidingPaneLayout.PanelSlideListener)\n - [SwipeRefreshLayout.OnChildScrollUpCallback](/reference/android/support/v4/widget/SwipeRefreshLayout.OnChildScrollUpCallback)\n - [SwipeRefreshLayout.OnRefreshListener](/reference/android/support/v4/widget/SwipeRefreshLayout.OnRefreshListener)\n - [TintableCompoundButton](/reference/android/support/v4/widget/TintableCompoundButton)\n-\n\n Classes\n -------\n\n - [AutoScrollHelper](/reference/android/support/v4/widget/AutoScrollHelper)\n - [CircularProgressDrawable](/reference/android/support/v4/widget/CircularProgressDrawable)\n - [CompoundButtonCompat](/reference/android/support/v4/widget/CompoundButtonCompat)\n - [ContentLoadingProgressBar](/reference/android/support/v4/widget/ContentLoadingProgressBar)\n - [CursorAdapter](/reference/android/support/v4/widget/CursorAdapter)\n - [DrawerLayout](/reference/android/support/v4/widget/DrawerLayout)\n - [DrawerLayout.LayoutParams](/reference/android/support/v4/widget/DrawerLayout.LayoutParams)\n - [DrawerLayout.SavedState](/reference/android/support/v4/widget/DrawerLayout.SavedState)\n - [DrawerLayout.SimpleDrawerListener](/reference/android/support/v4/widget/DrawerLayout.SimpleDrawerListener)\n - [EdgeEffectCompat](/reference/android/support/v4/widget/EdgeEffectCompat)\n - [ExploreByTouchHelper](/reference/android/support/v4/widget/ExploreByTouchHelper)\n - [ImageViewCompat](/reference/android/support/v4/widget/ImageViewCompat)\n - [ListPopupWindowCompat](/reference/android/support/v4/widget/ListPopupWindowCompat)\n - [ListViewAutoScrollHelper](/reference/android/support/v4/widget/ListViewAutoScrollHelper)\n - [ListViewCompat](/reference/android/support/v4/widget/ListViewCompat)\n - [NestedScrollView](/reference/android/support/v4/widget/NestedScrollView)\n - [PopupMenuCompat](/reference/android/support/v4/widget/PopupMenuCompat)\n - [PopupWindowCompat](/reference/android/support/v4/widget/PopupWindowCompat)\n - [ResourceCursorAdapter](/reference/android/support/v4/widget/ResourceCursorAdapter)\n - [ScrollerCompat](/reference/android/support/v4/widget/ScrollerCompat)\n - [SimpleCursorAdapter](/reference/android/support/v4/widget/SimpleCursorAdapter)\n - [SlidingPaneLayout](/reference/android/support/v4/widget/SlidingPaneLayout)\n - [SlidingPaneLayout.LayoutParams](/reference/android/support/v4/widget/SlidingPaneLayout.LayoutParams)\n - [SlidingPaneLayout.SimplePanelSlideListener](/reference/android/support/v4/widget/SlidingPaneLayout.SimplePanelSlideListener)\n - [Space](/reference/android/support/v4/widget/Space)\n - [SwipeRefreshLayout](/reference/android/support/v4/widget/SwipeRefreshLayout)\n - [TextViewCompat](/reference/android/support/v4/widget/TextViewCompat)\n - [ViewDragHelper](/reference/android/support/v4/widget/ViewDragHelper)\n - [ViewDragHelper.Callback](/reference/android/support/v4/widget/ViewDragHelper.Callback)"]]