var picker,view,hv={}; //Called when application is started. function OnStart() { //Create a layout with objects vertically centered. var lay = app.CreateLayout( "linear", "Left" ); //Create a full screen scroller var scroll = app.CreateScroller( 1.0, 0.95 ); lay.AddChild( scroll ); //Create a layout inside scroller. var layScroll = app.CreateLayout( "Linear", "Left" ); scroll.AddChild( layScroll ); view=app.CreateWebView(1.5,0.95); layScroll.AddChild(view); //Add layout to app. app.AddLayout( lay ); var path="/sdcard/DroidScript/Hello World/Img/Hello World.png"; hexViewStart(path,view); } function hexViewStart(fullPath,webView) { hv={chunksize:1024,path:fullPath}; hv.webView=webView; hv.file = app.CreateFile( hv.path, "r" ); hv.len = hv.file.GetLength(); hv.html="<p>"+fullPath+"</p><table>\n"; hv.file.Seek( 0 ); app.ShowProgress("Loading"); hexViewChunk(); } function hexViewChunk() { var pos=hv.file.GetPointer(); var whole = hv.file.ReadData( hv.chunksize,"int" ); if(whole == undefined) { hexViewEnd(); return; } var bull="•"; var int,hex,asc,hbuff,abuff,row; do { var data = whole.slice(0,8); whole=whole.slice(8); //var data = file.ReadData( 8,"int" ); if(data==undefined) break; var len = data.length; hbuff=""; abuff="<td style='background-color:#ddffdd;'>"; var pos8="<td>"+ ("00000000"+ pos.toString(16)).slice(-8).toUpperCase() + "</td>"; for(var i=0;i<len;i++) { int=data[i]; hex=("0"+int.toString(16)).slice(-2); asc=bull; if(int>31 && int<127) asc=String.fromCharCode(int); if(asc=="<")asc="<"; hbuff+="<td>"+hex.toUpperCase()+"</td >"; abuff+=asc; } abuff+="</td>"; row="<tr>"+pos8+hbuff+abuff+"</tr>"; if(len>0) hv.html +=row+"\n"; pos+=len; } while(len > 0); setTimeout("hexViewChunk()",1); } function hexViewEnd() { hv.html+="</table>"; app.HideProgress(); hv.webView.LoadHtml(hv.html); hv.file.Close(); } function pickit() { if( ! picker ) { picker = new FilePicker(openit,"/"); picker.SetFolder("/sdcard"); picker.SetHideFiles(false); } picker.Show(picker); } function openit(pth) { hexViewStart(pth,view); }