java - Out of memory exception while converting byte array to string [ displaying pdf on webview] +Android -


i'm using following code load pdf file on webview

try {         imagebytearray =loadfile(environment.getexternalstoragedirectory().getabsolutepath()+"/sample.pdf");     } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     }      webview = (webview)findviewbyid(r.id.webview1);      string image64 = base64.encodetostring(imagebytearray, base64.default);     string imgtag = "<img src=\"data:image/jpeg;base64," + image64 + "\" />" ;     webview.getsettings().setbuiltinzoomcontrols(true);      webview.setinitialscale(30);     websettings websettings = webview.getsettings();     websettings.setusewideviewport(true);     webview.loaddata(imgtag, "text/html", "utf-8"); 

but getting outofmemory exception while converting byte code string

question :

1.how can load large byte code string type
2.or can use other data type display byte array in webview
see in line "<imgsrc=\"data:image/jpeg;base64," + image64 + "\" />" have give string image64 . or there alternatives available ?


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -