Delete all tables from sqlite database
<p>I have done a lot of research and was unable to find a suitable method to delete all the tables in an SQLite database. Finally, I did a code to get all table names from the database  and <strong>I tried to delete the tables using the retrieved table names one by one</strong>. It didn't work as well. </p>

<p><strong>Please suggest me a method to delete all tables from the database.</strong></p>

<p>This is the code that I used:  </p>

<pre><code>public void deleteall(){
    SQLiteDatabase db = this.getWritableDatabase();
    Cursor c = db.rawQuery("SELECT name FROM sqlite_master WHERE type='table'", null);
    do
    {
        db.delete(c.getString(0),null,null);
    }while (c.moveToNext());
}
</code></pre>

<p>function <code>deleteall()</code> is called on button click whos code is given as below:  </p>

<pre><code>public void ButtonClick(View view)
{
    String Button_text;
    Button_text = ((Button) view).getText().toString();

    if(Button_text.equals("Delete Database"))
    {
        DatabaseHelper a = new DatabaseHelper(this);
        a.deleteall();
        Toast.makeText(getApplicationContext(), "Database Deleted Succesfully!", Toast.LENGTH_SHORT).show();
    }}
</code></pre>