小编use*_*681的帖子

如何在android中读取Epub文件的所有内容?

我想阅读所有toc的所有内容.
你可以告诉我如何阅读内容表(toc)中的所有章节.
请发布修改后的代码,以便我们可以阅读所有内容或发布一些内容,以便我可以阅读内容.

 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       AssetManager assetsmanger=getAssets();

        try {                                   
             // find InputStream for book                   
                InputStream  epubInputStream=assetsmanger.open("books/INCOME-TAX-ACT-1961.epub");

              // Load Book from inputStream
              Book book = (new EpubReader()).readEpub(epubInputStream);

            // Log the book's authors                         
              Log.i("epublib", "author(s): " +book.getMetadata().getAuthors());

                // Log the book's title  
             Log.i("epublib", "title: " + book.getTitle());

        String data=new String (book.getContents().get(3).getData()); 
         String k=data;
                web1=(WebView)findViewById(R.id.webView1);    
//                txt1=(TextView) findViewById(R.id.textView1);
//                txt1.setText(k);
            web1.loadData(k," text/html", "utf8");

        Bitmap coverImage=BitmapFactory.decodeStream(book.getCoverImage().getInputStream());

         Log.i("epublib" , "Coverimage is " + coverImage.getWidth() + " by "
                  + coverImage.getHeight() …
Run Code Online (Sandbox Code Playgroud)

java android epub

3
推荐指数
1
解决办法
6736
查看次数

标签 统计

android ×1

epub ×1

java ×1