Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

android - How to load an image stored in a byte array to WebView? -


everyone! have compressed lots of pictures "pictures.zip" file. want load 1 of these pictures webview this:

webview wv = (webview)findviewbyid(r.id.webview01); wv.loaddatawithbaseurl(null,"<img src=\"abc.jpg\">", "text/html", "utf-8", null); 

here,"abc.jpg" picture has been compressed pictures.zip file.

  1. i want decompress picture zip file , picture's byte stream, , load image webview byte stream.

  2. i don't want decompress picture zip file , save sdcard , load it.

  3. moreover, don't want encode pitcture's byte base64 , load image webview either, because these 2 ways slow.

as far know, there no way have 3 of these requirements. base64 encoding , loading image tag directly best bet if don't want write storage, although can still write internal storage , show in webview.

private static final string html_format = "<img src=\"data:image/jpeg;base64,%1$s\" />";  private static void openjpeg(webview web, byte[] image) {     string b64image = base64.encode(image, base64.default);     string html = string.format(html_format, b64image);     web.loaddata(html, "text/html", "utf-8"); } 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -