User Tools

Site Tools


Privacy Policy


Version 2.50 is out since Jan 1st 2022

Frequently Asked Questions


Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax


File Hex Viewer

Sample code

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 ); 
    //Add layout to app.    
    app.AddLayout( lay );
    var path="/sdcard/DroidScript/Hello World/Img/Hello World.png";
function hexViewStart(fullPath,webView)
  hv.file = app.CreateFile( hv.path, "r" );
  hv.len = hv.file.GetLength(); 
  hv.file.Seek( 0 );
function hexViewChunk()
  var pos=hv.file.GetPointer();
  var whole = hv.file.ReadData( hv.chunksize,"int" );
  if(whole == undefined)
  var bull="&bull;";
  var int,hex,asc,hbuff,abuff,row;
    var data = whole.slice(0,8);
    //var data = file.ReadData( 8,"int" );
    if(data==undefined) break;
    var len = data.length;
    abuff="<td style='background-color:#ddffdd;'>";
    var pos8="<td>"+
      pos.toString(16)).slice(-8).toUpperCase() +
    for(var i=0;i<len;i++)
      if(int>31 && int<127)
      hbuff+="<td>"+hex.toUpperCase()+"</td >";
    if(len>0) hv.html +=row+"\n";
  while(len > 0);
function hexViewEnd()
function pickit()
    if( ! picker )
       picker = new FilePicker(openit,"/");
function openit(pth)
sample_code/hexview.txt · Last modified: 2015/07/30 05:17 (external edit)