データベースのすべての人を表示するリストビューを作成しました。しかし、私が選択した行IDをどのように取得すれば、その情報を次のアクティビティに渡すことができますか? displays http://i.minus.com/iGEtGKGyF1Wgc.pngAndroid SQliteデータベースからリストビューの行IDを取得する
を表示
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.load_game1);
listContent = (ListView)findViewById(R.id.contentlist);
mDbAdapter = new DbAdapter(this);
mDbAdapter.open();
Cursor cursor = mDbAdapter.fetchAll();
startManagingCursor(cursor);
String[] from = new String[]{DbAdapter.KEY_NAME, DbAdapter.KEY_ROWID};
int[] to = new int[]{R.id.text};
cursorAdapter = new SimpleCursorAdapter(this, R.layout.row, cursor, from, to);
listContent.setAdapter(cursorAdapter);
mDbAdapter.close();
}
今私は、データベースからその行のIDを取得する名前をクリックします。
getItemIdはgetitemIdではないと思います –
あなたは正しいです、答えが更新されました。 –