Upon logout, I'm trying to drop all tables and then re create them when taken back to my LoginActivity.
I tried doing a deleteDatabase but this doesn't seem to be deleting the database at all because when I'm taken back to my LoginActivity, I can still query for the elements inside the database.
I'm trying to drop all tables from within my DrawerActivity when an onClick event is triggered. Here is what I have so far:
DrawerAdapter.java
@Override
public void onClick(View v) {
if(getPosition() == 1) {
context.deleteDatabase("mynew.db");
context.startActivity(new Intent(context, LoginActivity.class)); //end services here
}
}
Since the above is not working, I tried reading up on using the TableUtils to do my table dropping but I'm not sure if I'm supposed to be doing it this way inside my DrawerAdapter. If I am, how do I access those utilities from within the Adapter class? Then what's the next step when trying to recreate the tables that have been dropped?
Aucun commentaire:
Enregistrer un commentaire