If you have done a cursor adapter once, itis really easy.
I have put some example code here. It is stripped down
to the essentials:

public class HistoryCursorAdapter extends CursorAdapter {
        private Cursor cursor;

        public HistoryCursorAdapter(Context context, Cursor c) {
                super(context, c);
                cursor = c;
        }

        @Override
        public void bindView(View view, Context context, Cursor cursor) {
                 TextView tvSearchString = (TextView)
view.findViewById( R.id.search_string );
                   // this search_string_view must be part of the
layout created in newView.

                 String searchString =
cursor.getString( cursor.getColumnIndex( HistoryProvider.SEARCH_STRING));
                 tvSearchString.setText( searchString );
        }

        @Override
        public View newView(Context context, Cursor cursor, ViewGroup parent)
{
                LayoutInflater li =
(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                return li.inflate( R.layout.<put_your_listitem_layout_here>, 
parent,
false );
        }

}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to