android - Delete Database and re-create it -



android - Delete Database and re-create it -

i want every time database deleted,and create new one. code in dbhelper class:

public void createentry(string title, string getagonistiki, string getskor, string getgipedo, string date, string getgoal1, string getgoal2, string teliko_skor) { seek { contentvalues cv = new contentvalues(); cv.put(dbhelper.title, title); cv.put(dbhelper.agonistiki, getagonistiki); cv.put(dbhelper.skor, getskor); cv.put(dbhelper.gipedo, getgipedo); cv.put(dbhelper.date, date); cv.put(dbhelper.goala, getgoal1); cv.put(dbhelper.goalb, getgoal2); cv.put(dbhelper.description, teliko_skor); ourdatabase.insert("osfpdb", null, cv); } grab (exception e) { log.e("exception in insert :", e.tostring()); e.printstacktrace(); } } public void deleteall() { seek { ourdatabase.rawquery("delete osfpdb", null); } grab (exception e) { log.e("exception in prize delete query", e.tostring()); } }

and how phone call it:

hotornot entry = new hotornot(agones.this); entry.open(); entry.deleteall(); entry.createentry(msg.gettitle(), msg.getagonistiki(), msg .getskor(), msg.getgipedo(), msg.getdate(),msg.getgoal1(),msg.getgoal2(),msg.getdescription()); entry.close();

as result, m getting list item multiple times,like 1-30 , 1-30 1 time again etc..hope it's understandable

i see youre next new boston tuts :-) can simple re-create moste off next code

public string getdatabasepath(){ string path =ourcontext.getdatabasepath(database_name).tostring(); homecoming path; }

just set code youre hotornote class wanna create normal file deletion path used can't rember how youre deleting files sry

android database sqlite

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -