Android URI created by SQLite database

I created a database in Android using the bottom line of code -

SQLiteDatabase sampleDB = this.openOrCreateDatabase ("SAMPLE_DB_NAME", MODE_PRIVATE, null);

Now, I want to know what Uri will be for this database or how to find the Uri of the created database. Please help me.

Thanks in Advance Manoj

+3
source share
1 answer

Contents: //com.package_name.dbprovider_name/table_name

you have the following code

File dbFile = this.getDatabasePath(DB_NAME);
  for (File f:files) 
   {
        if (f.isDirector) 
                 searchFile(f);
        else if (f.getName().equals("accounts.db")) 
        {
            // delete db here...
            // and exit the search here...
        }
 }

if it contains the accounds.db file. If you get to another subdirectory, call your own function recursively with a subfolder as the starting point,

0
source

Source: https://habr.com/ru/post/1789955/


All Articles