Back

ScreenShot

JS Py
Hello World

Takes a screen shot of your app and saves it to the specified path.

app.ScreenShot( fileName, quality? )

Quality is an optional percentage value for jpg files defaulting to 95.

See also: GetMediaFile

Example - Take Screenshot

function OnStart()
{
    lay = app.CreateLayout( "linear" );
    img = app.CreateImage( null, 1, 1 );
    img.SetPaintColor( "green" );
    img.DrawCircle( 0.5, 0.5, 0.3 );
    lay.AddChild( img );
    app.AddLayout( lay );

    app.ScreenShot( "/sdcard/file.jpg" );
    img.SetImage( "/sdcard/file.jpg" );
}
from native import app

def OnStart():
    lay = app.CreateLayout("linear")
    img = app.CreateImage(None, 1, 1)
    img.SetPaintColor("green")
    img.DrawCircle(0.5, 0.5, 0.3)
    lay.AddChild(img)
    app.AddLayout(lay)

    app.ScreenShot("/sdcard/file.jpg")
    img.SetImage("/sdcard/file.jpg")
    Copy     Copy All       Run      
Number: percent
String: path to file ( “/absolute/...” or “relative/...” )