dimanche 3 avril 2016

prevent to duplicate entry in sqllite database android

create two table first is Item.db and second is TempItem.db both table has two entry when i add third entry in Item.db table and copy this entry into TempItem.db this time duplicate entry added in my TempItem table how to prevent this.my source code

for(int ip=0; ip<results.size(); ip++)
                         {
                             for(int ig=0; ig<resultmain.size(); ig++)
                             {
                                 if((results.get(ip).item).equals(resultmain.get(ig).item))
                                 {
                                     Toast.makeText(getApplicationContext(), "no", 100).show();
                                 }
                                 else
                                 {
                                     Toast.makeText(getApplicationContext(), "yea", 100).show();
                                 }

                             }
                         }

Aucun commentaire:

Enregistrer un commentaire