android - ReCreate Content provider after deletion -


i want delete sqlite db in application due reason:

this.deletedatabase(contentprovider.getdatabasename()); 

i want recreate database file after that.

i read in documentation :

oncreate called registered content providers on application main thread @ application launch time. 

and doing create db in oncreate @ launch time:

@override     public boolean oncreate() {         try {             contentproviderhelp = new contentproviderhelp();              userinfotable = new userinfotable(contentproviderhelp);             employeeinfotable = new employeeinfotable(contentproviderhelp);             productstable = new productstable(contentproviderhelp);              db = new dbmetadata(userinfotable, employeeinfotable, productstable);             ddlhelp = new ddlhelper(db);              matcher = new urimatch(userinfotable, employeeinfotable, productstable, new urimatcher(urimatcher.no_match));              dbhelp = new databasehelper(getcontext(), database_name, database_version, ddlhelp);             projectionmaps = new projectionhelper(db);             return true;         } catch (exception e) {             return false;         }     } 

can me how can recreate contentprovider after deletation of database file?

just create static function in databasehelper case , provide current context argument. in databasehelper can recreate database


Comments