I am working on an android app, and I want the user to be able to access the data directory. I know you can do, Runtime.getRuntime().exec("su");
, but I tried that and it opens up the screen that asks if you want to get permission, but it does not allow me to retrieve the directory after words. Here is the code:
try {
Runtime.getRuntime().exec("su");
final File dataFile = Environment.getDataDirectory();
FileAdapter adapter = new FileAdapter(getActivity());
adapter.setFiles(dataFile.listFiles());
setListAdapter(adapter);
setListShown(true);
} catch (IOException e) {
Toast.makeText(getActivity(),"Sorry, Root access was denied",Toast.LENGTH_LONG).show();
}