public SimpleCursorAdapter( context, int layout, c, from, int[] to, int flags)
Standard constructor.
Parameters
context | The context where the ListView associated with this SimpleListItemFactory is running |
---|---|
layout | resource identifier of a layout file that defines the views for this list item. The layout file should include at least those named views defined in "to" |
c | The database cursor. Can be null if the cursor is not available yet. |
from | A list of column names representing the data to bind to the UI. Can be null if the cursor is not available yet. |
to | The views that should display column in the "from" parameter. These should all be TextViews. The first N views in this list are given the values of the first N columns in the from parameter. Can be null if the cursor is not available yet. |
flags | Flags used to determine the behavior of the adapter, as per . |
SimpleCursorAdapter.ViewBinder
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.
public abstract boolean setViewValue ( view, 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 | the view to bind the data to |
---|---|
cursor | the cursor to get the data from |
columnIndex | the column at which the data can be found in the cursor |
Returns
- true if the data was bound to the view, false otherwise
Cursor要实现AbstractCursor
Public Methods
public void bindView( view, context, cursor)
Binds all of the field names passed into the "to" parameter of the constructor with their corresponding cursor columns as specified in the "from" parameter. Binding occurs in two phases. First, if a is available,
is invoked. If the returned value is true, binding has occured. If the returned value is false and the view to bind is a TextView,
is invoked. If the returned value is false and the view to bind is an ImageView,
is invoked. If no appropriate binding can be found, an
is thrown.
Parameters
view | Existing view, returned earlier by newView |
---|---|
context | Interface to application's global information |
cursor | The cursor from which to get the data. The cursor is already moved to the correct position. |
Throws
if binding cannot occur |