java - how read all content according to Chapter wise in android -
i able read content of 1 chapter want read chapter content please tell me how read page number.
public class logtestbookinfo extends activity { expandablelistview list; textview txt1; webview web1; imageview img1; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); assetmanager assetsmanger = getassets(); try { // find inputstream book inputstream epubinputstream = assetsmanger .open("books/income-tax-act-1961.epub"); // load book inputstream book book = (new epubreader()).readepub(epubinputstream); // log book's authors log.i("epublib", "author(s): " + book.getmetadata().getauthors()); // log 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 " + coverimage.getwidth() + " " + coverimage.getheight() + " pixels"); // log 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<tocreference> tocreferences, int depth) { // todo auto-generated method stub if (tocreferences == null) { return; } (tocreference tocreference : tocreferences) { stringbuilder tocstring = new stringbuilder(); (int = 0; < depth; i++) { tocstring.append("\t"); } hashmap<string, string> map = new hashmap<string, string>(); string k = tocstring.append(tocreference.gettitle()).tostring(); map.put("toc", k); arraylist<hashmap<string, string>> list1 = new arraylist<hashmap<string, string>>(); list1.add(map); string t = k; log.i("epublib", tocstring.tostring()); logtableofcontents(tocreference.getchildren(), depth + 1); } } }
@user1388681 facing same problem solved it. see answer on can't display table of contents or entire book on screen?
Comments
Post a Comment