Back to project page sloop-sql.
The source code is released under:
SloopSQL is released into the Public Domain. There are no restrictions on how you may use this code, and there is no warranty or guarantee of fitness for anything. USE AT YOUR OWN RISK (and enjoy).
If you think the Android project sloop-sql listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.megginson.sloopsql; /*from w w w. j a va2s.com*/ import android.content.Context; import android.database.Cursor; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.LinearLayout; import android.widget.ListAdapter; import android.widget.TextView; /** * Display a row in a list of database tables. */ public class TableListAdapter extends BaseAdapter implements ListAdapter { private Cursor mCursor; /** * The adapter always wraps a cursor. */ public TableListAdapter(Cursor cursor) { super(); mCursor = cursor; } @Override public Object getItem(int position) { return mCursor.toString(); } @Override public View getView(int position, View convertView, ViewGroup parent) { mCursor.moveToPosition(position); ViewGroup rowView = (ViewGroup)convertView; if (rowView == null) { rowView = (ViewGroup)Util.inflate(parent.getContext(), R.layout.table_list_row); } TextView typeView = (TextView)rowView.findViewById(R.id.table_type); TextView nameView = (TextView)rowView.findViewById(R.id.table_name); typeView.setText(mCursor.getString(mCursor.getColumnIndex("type"))); nameView.setText(mCursor.getString(mCursor.getColumnIndex("name"))); return rowView; } @Override public long getItemId(int position) { return mCursor.hashCode(); } @Override public int getCount() { return mCursor.getCount(); } }