I want my SQLite database instance to be wiped away when the program starts.
What I tried was make a method on my class MyDBAdapter.java like this:
p
The quick and easy solution that I used was to delete the database file in the OnCreate() method by calling another method named doDBCheck(). The doDBCheck() looks for the file on the emulator/phone's file system and if it exists, remove it.
private static final String DB_PATH = "data/data//databases/";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mainView = (TextView) findViewById(R.id.mainView);
doDBCheck();
}
private void doDBCheck()
{
try{
File file = new File(DB_PATH);
file.delete();
}catch(Exception ex)
{}
}