在FbReader开源代码中设置文件路径

时间:2013-09-25 06:14:39

标签: android epub ebook-reader

我正在开发一个应用程序,它将.epub文件从资产复制到设备,然后从该位置读取.epub文件。我正在使用免费的开源FBReader来读取epub文件。任何人都知道如何设置应用程序启动时直接打开的书的路径。

我尝试使用此link中的代码。我将此代码复制粘贴到新类中,但是当应用程序启动时,它会显示有关FBreader页面的信息。

1 个答案:

答案 0 :(得分:0)

我发现了这个..希望这会对你有所帮助

String path = /data/data/<app_package_name>/filename.epub
File file = new File(path);
    if (extension.equals(".epub") || ext.equals(".txt") || ext.equals(".doc")
                        || ext.equals(".rtf") || ext.equals(".fb2")) {
                    intent.setDataAndType(Uri.fromFile(file), "application/epub" + " OR "
                            + "application/txt" + " OR " + "application/doc" + " OR "
                            + "application/rtf" + " OR " + "application/fb2");
                    ComponentName cn = new ComponentName("org.geometerplus.zlibrary.ui.android",
                            "org.geometerplus.android.fbreader.FBReader");
                    intent.setComponent(cn);
                }