4

I have some epub files that I saved to android internal storage. I have been using folioReader library to display this files but it keeps telling me the path destination is null.

So, I checked android studio's Device File Explorer and I found the files this location: /data/data/packageName/files/FileName

Am using this code to get path:

try{
            String path = getFilesDir().getPath() + "/" + fileName
            folioReader.openBook(path);
                Log.i("Path:", path);
        } catch (Exception e){
            e.printStackTrace();
        }
    }

It returns this path on my log cat:

/data/user/0/packageName/files/fileName

There seems to be a difference in the locations paths.

So, my question is this: how do I get path to this location?

/data/data/packageName/files/FileName
bensofter
  • 760
  • 1
  • 14
  • 27

1 Answers1

0
private String getFilePath(){
    ContextWrapper contextWrapper = new ContextWrapper(getApplicationContext());
    File filePath = contextWrapper.getFilesDir();
    File file = new File(filePath,"fileName" +"*/*");
    return file.getPath();
}

here 'filePath' contains '/data/data/packageName/files/' location then joining it with '/fileName' gives the whole storage path of that file

*/ * tells that 'fileName' can be of any file type

Disco
  • 1
  • 1