Is it possible to get path of database file in android at path : \"/data/system/accounts.db\"
in my app i want to use this database, but not getting its path. if i do ha
You can use android.os.Environment.getDataDirectory()
to get the path to the data directory.
Don't use the mContext.getDatabasePath if the db is not in the data dir of your app.
Also see Is it possible to move the internal DB to the SDCard?
if you want to search, do a recursive file search via something like this:
private void searchFile(String startingPoint) {
Files[] files = File("/data").listFiles();
for (File f:files) {
if (f.isDirector) searchFile(f);
else if (f.getName().equals("accounts.db")) {
// delete db here...
// and exit the search here...
}
}
}
and check if it contains the accounds.db. If you reach another subdirectory, call your own function recursively with the subfolder as the starting point, and so on....
But make sure you have read access to the relevant folder you set as starting point to start the search.