i developed a small java.lang.reflect.InvocationHandler that intercepts method calls (from a json webservice) and cache the results to a local SQLite db. if there is no internet connection results are read from local cache.
everything works fine; my problem is the following:
every method intercepted can return a different entity, and i save using reflection each entity on a different table. i don't know in advance all the tables i need to create, so every time i create a SQLiteOpenHelper that "create table if not exists {ENTITY_NAME}", and every time i increase the database version by 1 so the method onUpgrade is called.
this works on development environment but i don't like that at all.
someone can recommend a better solution to update the database with new tables?
thank you
Try mYourDbHelper.getWritableDatabase().execSQL("CREATE TABLE ....")
from where you need to create another table