Back

ChooseFile

Hello World

ChooseFile opens a file picker for user to select a file.

app.ChooseFile( message, type, callback, fldr )

See Also: ReadFile

Example - Choose File by Mimetype

function OnStart()
{
    lay = app.CreateLayout( "linear", "VCenter,FillXY" );

    var list = "*/*,application/text,application/apk,application/zip," +
        "audio/mpeg,audio/mp4,audio/ogg,image/png,image/jpeg,text/css," +
        "text/html,text/javascript,text/plain,video/mpeg,video/mp4,video/ogg";

    spnMime = app.CreateSpinner(list);
    lay.AddChild(spnMime);

    btnChoose = app.CreateButton( "Choose File", 0.5, 0.1 );
    btnChoose.SetOnTouch( btnChoose_OnTouch );
    lay.AddChild( btnChoose );

    app.AddLayout( lay );
}

function btnChoose_OnTouch()
{
    app.ChooseFile( "Choose a File", spnMime.GetText(), OnChoose );
}

function OnChoose( file )
{
    alert( "file path: " + file );
}
    Copy     Copy All       Run      
string
string: path to file or folder ( “/absolute/...” or “relative/...” )
string: “mimetype”
function( path )