Open Aya-Hassan opened 11 years ago
Using readEpub()
prompts epublib to load the entire asset into memory - I would suggest looking at readEpubLazy()
mentioned [here](http://www.siegmann.nl/static/epublib/apidocs/nl/siegmann/epublib/epub/EpubReader.html#readEpubLazy%28java.lang.String, java.lang.String%29)
01-15 11:04:25.224: E/AndroidRuntime(634): FATAL EXCEPTION: main 01-15 11:04:25.224: E/AndroidRuntime(634): java.lang.OutOfMemoryError 01-15 11:04:25.224: E/AndroidRuntime(634): at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:122) 01-15 11:04:25.224: E/AndroidRuntime(634): at nl.siegmann.epublib.util.IOUtil.toByteArray(IOUtil.java:45) 01-15 11:04:25.224: E/AndroidRuntime(634): at nl.siegmann.epublib.domain.Resource.(Resource.java:114)
01-15 11:04:25.224: E/AndroidRuntime(634): at nl.siegmann.epublib.util.ResourceUtil.createResource(ResourceUtil.java:64)
01-15 11:04:25.224: E/AndroidRuntime(634): at nl.siegmann.epublib.epub.EpubReader.readResources(EpubReader.java:188)
01-15 11:04:25.224: E/AndroidRuntime(634): at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:94)
01-15 11:04:25.224: E/AndroidRuntime(634): at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:53)
01-15 11:04:25.224: E/AndroidRuntime(634): at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:37)
01-15 11:04:25.224: E/AndroidRuntime(634): at epub.reader.EpubReader.onCreate(EpubReader.java:34)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.app.Activity.performCreate(Activity.java:5008)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.app.ActivityThread.access$600(ActivityThread.java:130)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.os.Handler.dispatchMessage(Handler.java:99)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.os.Looper.loop(Looper.java:137)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.app.ActivityThread.main(ActivityThread.java:4745)
01-15 11:04:25.224: E/AndroidRuntime(634): at java.lang.reflect.Method.invokeNative(Native Method)
01-15 11:04:25.224: E/AndroidRuntime(634): at java.lang.reflect.Method.invoke(Method.java:511)
01-15 11:04:25.224: E/AndroidRuntime(634): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
01-15 11:04:25.224: E/AndroidRuntime(634): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-15 11:04:25.224: E/AndroidRuntime(634): at dalvik.system.NativeStart.main(Native Method)
My code is just:
WebView webview = (WebView) findViewById(R.id.webView1); try { InputStream inputFile = getAssets().open("linear_algebra.epub");