如何在安卓中的应用程序缓存中打开和读取此文件?



我的应用程序在此位置创建一个文件

绝对路径

/data/user/0/in.eaft.contentsecurityplayer/cache/.epubA-Room-with-a-View-morrison.epub

规范路径

/data/data/in.eaft.contentsecurityplayer/cache/.epubA-Room-with-a-View-morrison.epub

我需要传递此库的真实路径,以便它打开 EPUB 文件

我需要打开这个文件

folioReader.setConfig(config, true)
.openBook(filePath);

如果我传递像/storage/sample.epub这样的文件路径,它会打开,但当我传递上面的路径文件时,文件没有打开。

如何从缓存目录打开此文件?

您需要添加以下代码,因为它是基于上下文的:

String cacheDir = context.getCacheDir();

这将为您提供路径

最新更新