DroidScript Hello World Example

The 'Hello World' Project is the first app you will see in DroidScript.
It creates an image and a button. And if you press the button, a "Hello World!" popup appears and the phone is vibrating.
This is a very basic demonstration of how easy DroidScript can be used:

- create the main app-layout.
- add controls or more layouts to it
- show the layout on screen

This is the basic concept of how DroidScript works. Try it out yourself: Download DroidScript
//Called when application is started. function OnStart() { //Create a layout with objects vertically centered. lay = app.CreateLayout("linear ", "VCenter,FillXY "); //Create image 1/5 of screen width and correct aspect ratio. img = app.CreateImage("Img/Hello World.png ", 0.2, -1); lay.AddChild(img); //Create a button 1/3 of screen width and 1/10 screen height. btn = app.CreateButton("Press Me ", 0.3, 0.1); btn.SetMargins(0, 0.05, 0, 0); lay.AddChild(btn); //Set function to call when button pressed. btn.SetOnTouch(btn_OnTouch); //Add layout to app. app.AddLayout(lay); } //Called when user touches our button. function btn_OnTouch() { //Show a popup message. app.ShowPopup("Hello World! "); //Vibrate phone with a pattern (in milliseconds). //pause,vibrate,pause,vibrate... app.Vibrate("0,100,30,100,50,300 "); }

Comments

  1. Replies
    1. Can you make give me an account wallet with money in crypto currency?

      Delete
  2. github.com/77553322AHST/droidscript.org/temir5.org/mullvat.net

    ReplyDelete

Post a Comment

Popular posts from this blog

Creating DroidScript Plugins on Mobile with AIDE - 2 (DS SDK)

Creating DroidScript Plugins on Mobile with AIDE

Creating DroidScript Plugins on Desktop PC with Android Studio