0

Does anyone know how to reset the database everytime my application executes in real device ?

I currently have this code but it does not work...

public void doDBCheck()
    {
        try{
                File file = new File(context.getExternalFilesDir(null).getAbsolutePath());
                file.delete();
        }catch(Exception ex)
        {
            }
        }

Any solutions ?

edmund02
  • 55
  • 8

1 Answers1

0
public void clearDatabase()
{
SQLiteDatabase db = helper.getWritableDatabase();
db.delete({tablename},null,null) // write this line for each table in your db.
}
W.K.S
  • 9,787
  • 15
  • 75
  • 122