How to Delete Sqlite Database Android Code

http://www.stevenmcmillan.co.uk/blog/2012/java-sqlite-database-helper-class-for-android/

public class DBHelper extends SQLiteOpenHelper {
 
		//The Android's default system path of your application database.
    private static String DB_PATH = "/data/data/my.site.mypackage/databases/";
    private static String DB_NAME = "mesta";
    private static Context myContext;
 public DBHelper(Context context) {
        super(context, DB_NAME, null, DB_VERS);
       myContext = context;
 
    }
 
 
  boolean b = myContext.deleteDatabase(DB_NAME); // true if deleted
 
  // DEPRECATED
  SQLiteDatabase.deleteDatabase(new File(DB_PATH + DB_NAME));
 
}
This entry was posted in SQLite database and tagged . Bookmark the permalink.


Comments are closed.



11,296 views