DROP TABLE not work in sqlite
android, drop-table, sqlite
Solution
`onCreate` will work only once at time of creation once the database is created you should make use of `onUpgrade()` to drop table if any changes has been made to old version
EDIT http://www.vogella.com/articles/AndroidSQLite/article.html
Problem
I try to drop table programmatically nothing error show in logcat, but there has no any result : Here my Database Helper class : ``` public class database1 extends SQLiteOpenHelper { private static final String DB_Name="database"; private static final int DB_Version=1; private static final String tbl_arrival1="arrival1"; private static final String STRING_CREATE1 = "CREATE TABLE IF NOT EXISTS "+tbl_arrival1 +" (_f_id INTEGER PRIMARY KEY AUTOINCREMENT, " +"f_date TEXT," +"o_rder NUMERIC," +"rem_com TEXT);"; public database1 (Context ctx) { super(ctx,DB_Name,null,DB_Version); } @Override public void onCreate(SQLiteDatabase database) { databaseQuery.onCreate(database); } public static class databaseQuery { public static void onCreate(SQLiteDatabase database) { database.execSQL("DROP TABLE IF EXISTS "+tbl_arrival1); database.execSQL(STRING_CREATE1); } } } ``` I use this database helper in content provider : ``` database1 DBHelper ; public Uri insert(Uri uri, ContentValues values) { long row_id; SQLiteDatabase sqlDB = DBHelper.getWritableDatabase(); row_id=sqlDB.insert(tbl_arrival1, null, values); if(row_id>0) { Uri _uri = ContentUris.withAppendedId(CONTENT_URI, row_id); getContext().getContentResolver().notifyChange(_uri, null); return _uri; } throw new SQLException("Failed to insert into "+uri); } ``` The problem is that, the query drop table, is not working! All suggestion and answer would be highly appreciated... thanks