CursorAdapter
カスタムを作成しようとしています。私はDBAdapter
クラスにあるデータベースをセットアップしました。私が持っている:CursorAdapterにカーソルを設定する機能がないようです
public class ExampleCursorAdapter extends CursorAdapter {
public ExampleCursorAdapter(Context context, Cursor c) {
super(context, c);
}
public void bindView(View view, Context context, Cursor cursor) {
TextView summary = (TextView)view.findViewById(R.id.label);
summary.setText(cursor.getString(
cursor.getColumnIndex(DBAdapter.question)));
}
public View newView(Context context, Cursor cursor, ViewGroup parent) {
LayoutInflater inflater = LayoutInflater.from(context);
View v = inflater.inflate(R.layout.more_results, parent, false);
bindView(v, context, cursor);
return v;
}
}
は私がExampleCursorAdapter
のインスタンスを作成しています詳細なフィードバックのクラスを持っています。私が持っている問題は、CursorAdapter
を設定するものがないようです。
public class DetailedFeedback extends ListActivity {
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Cursor c = db.getAllContacts();
ExampleCursorAdapter adapter = new ExampleCursorAdapter(this, c);
setListAdapter(adapter);
}
}
これが正しい構文であるかどうかはわかりません。
返信しようとしている列と同じにする – al23dev
@Alexanderデータベースのクエリ方法を知っていますか? '_id'と' DBAdapter.question'カラムのデータベースに問い合わせを行った後、カーソルを返します。 – Luksprog
カーソルに何を割り当てようとしているのか分かりません。 – al23dev