Reputation: 29553
How do i delete a whole table in android through code?
Upvotes: 1
Views: 3440
Reputation: 1250
You can delete a database easily by writing a test case inheriting from AndroidTestCase (You don't have to but its an option), that way you will get access to Context, and call deleteDatabase("mydatabase.db") on it.
Upvotes: 0
Reputation: 64409
I'd say just use a DROP TABLE
query?
(I'm asuming you're talking about a database, and you're using the SQLite that's in Android, right? http://www.sqlite.org/lang_droptable.html )
an example as requested:
DROP TABLE IF EXISTS mydatabase.myTable
Upvotes: 1