I am developing android app. I have to develop a xml button in my activity, and construct my sqlite database and tables. How can I just let user press a button to delete a table? Thanks.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How can I create this custom Bottom Navigation on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
As a Singleton method
Hard to answer without more context, but the ultimate sqlite query would be:
Where db is a reference to a SqliteDatabase object.
There is some ambiguity with your question. Note that there is a difference between DELETING a table and DROPPING a table. Deleting the table simply erases all data from its rows:
After this, you can still reference the table because it still exists, but creating a new one with the same name may be problematic without using the CREATE TABLE IF NOT EXISTS expression in sql.
Using DROP TABLE completely removes the table and it cannot be referenced again unless it is re-created.
As noted by others, this should work if you want it completely removed from the database: