I’m rewriting the Examine the Scriptures Daily android app. With the ESD files published as ePub files it’s easier to get the data now, and it will allow more languages to be supported without the hassle of converting from WTLib.
Here’s the code snippet I’m using to read the ePub book. The library I’m using is ePubLib, and I’m displaying the page in a standard WebView:
// Load the book and get a specific date
AssetManager assetManager = getAssets();
try {
// find InputStream for book
InputStream epubInputStream = assetManager.open("es12_E.epub");
// Load Book from inputStream
this.book = (new EpubReader()).readEpub(epubInputStream);
getSpecificdate("2012-12-1");
} catch (IOException e) {
Log.e("epublib", e.getMessage());
}
private void getSpecificdate(String day) {
Date d;
int dayOfMonth;
int monthOfYear;
Calendar cal = Calendar.getInstance();
try {
d = dateFormat.parse(day);
cal.setTime(d);
String hrefDate = hrefFormat.format(d).toUpperCase();
dayOfMonth=cal.get(Calendar.DAY_OF_MONTH);
monthOfYear=cal.get(Calendar.MONTH);
hrefDate += (dayOfMonth==1) ? ".xhtml" : "-split"+dayOfMonth+".xhtml";
hrefDate = dblzero.format(monthOfYear+4)+hrefDate.substring(2);
// Here's the part you're looking for
Resource r = this.book.getResources().getByHref(hrefDate);
WebView wv = (WebView) findViewById(R.id.webView1);
String data = new String( r.getData() );
wv.loadDataWithBaseURL("file:///android_asset/", data, "text/html", "utf-8", null);
} catch (ParseException e) {
e.printStackTrace();
}
}