However if the file is very large or you have some other good reason to read it line by line, you can open the file for random access.
var fil = "/sdcard/sh_out.txt";
//Called when application is started.
function OnStart()
{
//Create a layout with objects vertically centered.
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
//Create a text label and add it to layout.
txt = app.CreateText( "",0.9,0.5,"log" );
lay.AddChild( txt );
//Create a button
btn = app.CreateButton( "Read" );
btn.SetOnTouch( readLine );
lay.AddChild( btn );
//Add layout to app.
app.AddLayout( lay );
//Open file for reading
file1 = app.CreateFile( fil,"r" );
readLine();
}
function readLine()
{
var s = file1.ReadText("Line");
txt.Log( s );
}