/** * Standard constructor. * * @param context The context where the ListView associated with this * SimpleListItemFactory is running * @param 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" * @param c The database cursor. Can be null if the cursor is not available yet. * @param from A list of column names representing the data to bind to the UI. Can be null * if the cursor is not available yet. * @param 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. * @param flags Flags used to determine the behavior of the adapter, * as per {@link CursorAdapter#CursorAdapter(Context, Cursor, int)}. */ public SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, flags); mTo = to; mOriginalFrom = from; findColumns(from); }
/** * Standard constructor. * * @param context The context where the ListView associated with this * SimpleListItemFactory is running * @param 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" * @param c The database cursor. Can be null if the cursor is not available yet. * @param from A list of column names representing the data to bind to the UI. Can be null * if the cursor is not available yet. * @param 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. * @param flags Flags used to determine the behavior of the adapter, * as per {@link CursorAdapter#CursorAdapter(Context, Cursor, int)}. */ public SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, flags); mTo = to; mOriginalFrom = from; findColumns(from); }
/** * Constructor the enables auto-requery. * * @deprecated This option is discouraged, as it results in Cursor queries * being performed on the application's UI thread and thus can cause poor * responsiveness or even Application Not Responding errors. As an alternative, * use {@link android.app.LoaderManager} with a {@link android.content.CursorLoader}. */ @Deprecated public SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) { super(context, layout, c); mTo = to; mOriginalFrom = from; findColumns(from); }
/** * Constructor the enables auto-requery. * * @deprecated This option is discouraged, as it results in Cursor queries * being performed on the application's UI thread and thus can cause poor * responsiveness or even Application Not Responding errors. As an alternative, * use {@link android.app.LoaderManager} with a {@link android.content.CursorLoader}. */ @Deprecated public SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) { super(context, layout, c); mTo = to; mOriginalFrom = from; findColumns(from); }
@Override public Cursor swapCursor(Cursor c) { Cursor res = super.swapCursor(c); // rescan columns in case cursor layout is different findColumns(mOriginalFrom); return res; }
@Override public Cursor swapCursor(Cursor c) { Cursor res = super.swapCursor(c); // rescan columns in case cursor layout is different findColumns(mOriginalFrom); return res; }
/** * Change the cursor and change the column-to-view mappings at the same time. * * @param c The database cursor. Can be null if the cursor is not available yet. * @param from A list of column names representing the data to bind to the UI. Can be null * if the cursor is not available yet. * @param 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. */ public void changeCursorAndColumns(Cursor c, String[] from, int[] to) { mOriginalFrom = from; mTo = to; super.changeCursor(c); findColumns(mOriginalFrom); }
/** * Change the cursor and change the column-to-view mappings at the same time. * * @param c The database cursor. Can be null if the cursor is not available yet. * @param from A list of column names representing the data to bind to the UI. Can be null * if the cursor is not available yet. * @param 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. */ public void changeCursorAndColumns(Cursor c, String[] from, int[] to) { mOriginalFrom = from; mTo = to; super.changeCursor(c); findColumns(mOriginalFrom); }