How to read EPUB book using EPUBLIB?

后端 未结 2 1065
既然无缘
既然无缘 2021-02-10 04:31

I found a solution for reading epub books in android using epublib. I am able to read the subtitles of the book. But I didn\'t find a way to read the line by line of the content

2条回答
  •  醉酒成梦
    2021-02-10 05:05

    Well - i'm not exacly sure about navigating, but also wonder how to do it For now - i have something like this (it is line - by line read):

    private void logTableOfContents(List tocReferences, int depth) {
        if (tocReferences == null) {
            return;
        }
        for (TOCReference tocReference : tocReferences) {
            StringBuilder tocString = new StringBuilder();
            for (int i = 0; i < depth; i++) {
                tocString.append("\t");
            }
            try{
               InputStream is = tocReference.getResource().getInputStream();
               BufferedReader r = new BufferedReader(new InputStreamReader(is));
               String line;
               while ((line = r.readLine()) != null) {
                   String line = Html.fromHtml(line).toString();
               }
            }
            catch(IOException e){
    
            }
    
    
    
    
            //logTableOfContents(tocReference.getChildren(), depth + 1);
        }
    }
    

提交回复
热议问题