Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/220.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何使用EPUBLIB阅读EPUB书籍?_Android_Epub_Epublib - Fatal编程技术网

Android 如何使用EPUBLIB阅读EPUB书籍?

Android 如何使用EPUBLIB阅读EPUB书籍?,android,epub,epublib,Android,Epub,Epublib,我找到了一个在android中使用epublib阅读epub书籍的解决方案。我能看懂这本书的副标题。但我并没有找到一种方法来逐行阅读内容。我怎样才能做到这一点 获取该书标题的示例代码为 private void logTableOfContents(List<TOCReference> tocReferences, int depth) { if (tocReferences == null) { return; } for (TOCRef

我找到了一个在android中使用epublib阅读epub书籍的解决方案。我能看懂这本书的副标题。但我并没有找到一种方法来逐行阅读内容。我怎样才能做到这一点

获取该书标题的示例代码为

  private void logTableOfContents(List<TOCReference> tocReferences, int depth) {
    if (tocReferences == null) {
        return;
    }
    for (TOCReference tocReference : tocReferences) {
        StringBuilder tocString = new StringBuilder();
        StringBuilder tocHref=new StringBuilder();
        for (int i = 0; i < depth; i++) {
            tocString.append("\t");
            tocHref.append("\t");
        }
        tocString.append(tocReference.getTitle());

        tocHref.append(tocReference.getCompleteHref());
        Log.e("Sub Titles", tocString.toString());
        Log.e("Complete href",tocHref.toString());

        //logTableOfContents(tocReference.getChildren(), depth + 1);
    }
}
private void内容日志表(列表引用,int深度){
if(tocpreferences==null){
返回;
}
for(TOCReference TOCReference:tocReferences){
StringBuilder tocString=新的StringBuilder();
StringBuilder tocHref=新建StringBuilder();
for(int i=0;i
从你那里得到这个密码


我怎样才能得到这本书的故事

嗯-我对导航不是很确定,但也不知道如何导航 现在-我有类似的东西(逐行阅读):

private void内容日志表(列表引用,int深度){
if(tocpreferences==null){
返回;
}
for(TOCReference TOCReference:tocReferences){
StringBuilder tocString=新的StringBuilder();
for(int i=0;i
我不确定这是否是在epub文件中导航的方式。据我所知(到目前为止,我还在学习),获取所有书籍内容的更好方法是基于书脊部分。 但我仍然不知道如何将这两件事(TOC和real spine)与epublib接口连接起来。 根据文件: “书脊部分是书中按阅读顺序排列的部分。这与目录部分形成对比,目录部分是本书各部分的索引。”

如果你愿意,这是一个片段:

Spine spine = new Spine(book.getTableOfContents());
for (SpineReference bookSection : spine.getSpineReferences()) {
            Resource res = bookSection.getResource();
                try {
                    InputStream is = res.getInputStream();
                    //do something with stream
                } catch (IOException e) {

嘿,谢谢……这个脊椎到底是干什么用的??我从哪里获得了ePubLib的文档…我如何找到ePubLib文档?它一次读取所有引用的所有内容。我认为这会损害效率。
Spine spine = new Spine(book.getTableOfContents());
for (SpineReference bookSection : spine.getSpineReferences()) {
            Resource res = bookSection.getResource();
                try {
                    InputStream is = res.getInputStream();
                    //do something with stream
                } catch (IOException e) {