does anyone have good code examples of inserting listview into sqlite database? i googled how to insert listview into database but most have examples on how to display listview from database instead. so yah please help me thanks!
1 に答える
0
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
//get clickedItem details using position and insert these details into the database table.
}
}
});
listView はリスト ビューです。整数パラメータ「position」は、クリックした ListView アイテムの位置を示します。それを使用して詳細を取得できます
詳細は次のように取得できます。
String[] items = {"", "", .....};
この String 配列を使用して listView に入力し、次に使用してクリックされたアイテムの詳細を取得します
String clickedItem = String[position];
これらの詳細をデータベース テーブルに挿入します。
于 2012-07-23T08:23:15.173 に答える