Possible Duplicate:
How do I list the tables in a SQLite database file
I am trying to make a simple interface for creating a simple database using Android device. For example, a program for inserting my home collection of movies into database. Maybe I am wrong from the start, but this is my try:
Here I retrieve data from fields and insert them into a new table.
EditText title = (EditText)findViewById(R.id.Title);
String Title = title.getText().toString();
EditText d = (EditText)findViewById(R.id.director);
String Director = d.getText().toString();
SQLiteDatabase db = openOrCreateDatabase("Films", MODE_PRIVATE, null);
db.execSQL("CREATE TABLE IF NOT EXISTS " + Title + " (Title VARCHAR, Director VARCHAR);");
db.execSQL("INSERT INTO " + Title + "(Title) VALUES('" + Title + "');");
db.execSQL("INSERT INTO " + Title + " (Director) VALUES('" + Director + "');");
db.close();
So for each new Title I create a new table. But then I need all of these tables to print them in a new Activity as a list or something like that. But I don't know how to get all the tables from database.
I found the command:
SQLiteDatabase db = openOrCreateDatabase("Films", MODE_PRIVATE, null);
Cursor c = db.rawQuery("SELECT * FROM tablename", null);
But it works only for one table if I know its name, and what I need is to get all the tables and the data from them.
Could you help me please?