次の方法を使用してデータベースに名前を挿入しています
public void insertContact(String name)
{
ContentValues newContact = new ContentValues();
newContact.put("name", name);
open(); // open the database
database.insert("contacts", null, newContact);
close(); // close the database
} // end method insertContact
データの重複を防ぐために何らかのチェックを行うことはできますか? 名前がデータベースに既に存在する場合、新しい名前を挿入するべきではありません。