java - Display present SQLite databases on listview -
I want to add all the databases on my Android phone to the program and display them all on the list view, But I could not find any solution.
I got this code from Google, but it does not show all the current databases in the list view.
Private array list & lt; String & gt; GetDBFILES () {ArrayList & lt; String & gt; Arr = new arreelist & lt; String & gt; (); String db_path, rand_name, str_tmp; //ad.1-2 Rand_name = Random file name for DB = new random (). NextInt ((4000000-2000 + 1) +2000) + ".db"; Db_path = openOrCreateDatabase (rand_name, MODE_PRIVATE, null) .getPath (); //ad.3. DeleteDatabase (rand_name); //ad.4 Db_path = db_path.replace ("/" + rand_name, ""); //ad.5. File [] files = new file (db_path) .listFiles (); If (files == faucet) {return tap; } // So now we can get file names one (int i = 0; i & lt; files.length; i ++) {str_tmp = files [i] .getName () for one; If (str_tmp.endsWith ("- magazine")) {arr.add (str_tmp); }} Return arr; }
OK you can not! You can only access your app database! If you have more than one app then you can still access the database from your other apps using some other tests! (Run them all under the same sandbox)
Although you do not have permission to use other application databases, some applications (including Android system) content providers have been provided. You can not manipulate the database directly, but you can use the content provider for each app that ultimately runs the query on the database.
Comments
Post a Comment