Hi everyone i try to show content of epub using epublib. this is my code
File f = new File(Environment.getExternalStorageDirectory() + "/documents/cindersilly.epub");
String path = f.getPath();
FileInputStream epubInputStream = new FileInputStream(f);
Book book = new EpubReader().readEpub(epubInputStream);
wvTest.loadDataWithBaseURL(f.getAbsolutePath(), book.getContents().get(0).getData().toString(), "text/html", "UTF-8", null);
and i get result :
[B@41408d8
what is that? and how to solve this so the content will show on the webview? thanks
You haven't posted enough code to be able to see all the details, but your
getData()
method is returning abyte[]
. When you invoketoString()
on an object, it tries to convert it into aString
; but arrays don't have atoString()
that returns anything particularly useful. What you get is a header ([B
) that tells you its type (byte array), and an address that says where in JVM memory it's stored.If you want to be able to see the contents of the array, you can use
Arrays.toString()
to turn it into something more useful. You pass it thebyte[]
you've got (in this case, the output ofgetData()
) and it constructs theString
representation for you. Your code would look like this:It's also possible you weren't intending it to return a
byte[]
at all, in which case your problem is further back in your code.