Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to read all content of Epub file in android?
    text
    copied!<p>I want to read all content of all toc. <br>Can u please tell me how to read all chapter which is there in table of content(toc ).<br>Please post modified code so that we can read all content or post some thing so that i can read content .</p> <pre><code> 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() + " pixels"); // Log the tale of contents logTableOfContents(book.getTableOfContents().getTocReferences(), 0); // list=(ExpandableListView)findViewById(R.id.expandableListView1); // img1=(ImageView)findViewById(R.id.imageView1); // img1.setImageBitmap(coverImage); } catch (IOException e) { // TODO Auto-generated catch block Log.e("epublib", e.getMessage()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } private void logTableOfContents(List&lt;TOCReference&gt; tocReferences, int depth) { // TODO Auto-generated method stub if(tocReferences== null ){ return; } for(TOCReference tocReference:tocReferences){ StringBuilder tocstring=new StringBuilder(); for(int i=0;i&lt;depth;i++) { tocstring.append("\t"); } HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); String k= tocstring.append(tocReference.getTitle()).toString(); map.put("TOC",k); ArrayList&lt;HashMap&lt;String, String&gt;&gt; list1 = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); list1.add(map); String t=k; Log.i("epublib", tocstring.toString()); logTableOfContents(tocReference.getChildren(), depth + 1); } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload