// ************************************************** // * Welcome to the Wonderful World of DroidScript! * // ************************************************** // // DroidScript is a programming tool for Android. The text in this // window is JavaScript code that can run on your device. // // Kindly use Firefox 3.5 or later with this page. // // Click the link "Help & Download" below to download the DroidScript app. // // How To: // 1) Make sure you are using a web browser that supports XMLHttpRequest // Level 2. Firefox 3.5 or later is recommended. Other browsers will not work. // 2) Install the app http://droidscript.se/DroidScript.apk on your Android device. // 3) Make sure that both your computer and the device are connected to the // same wireless network, and that wifi networking is enabled on the device. // 4) Start DroidScript on the device. Press menu button, select "Start server". // 5) Enter the ip-address shown on the start screen in the text box above. // 6) Select code you want to run and click the Run button. // 7) Have fun! // Toast example program. Select this code and click Run. var Toast = Packages.android.widget.Toast; Toast.makeText( Activity, "Hello World!", Toast.LENGTH_SHORT).show(); // Select this code and click Run. It will create a button in // the server activity. var button = new Packages.android.widget.Button(Activity); button.setText("Hello World!"); button.setOnClickListener(function () { button.setText("You Clicked Me!"); }) Activity.setContentView(button); // You can also run code as a new Activity. Select this code // and click "Run as Activity". A new DroidScript activity will // be created, and the onCreate function is called. function onCreate(icicle) { var widget = Packages.android.widget; var graphics = Packages.android.graphics; var font = graphics.Typeface.create( graphics.Typeface.SANS_SERIF, graphics.Typeface.BOLD); var button = new widget.Button(Activity); button.setText("Hello World!"); button.setTypeface(font); button.setTextSize(26); button.setBackgroundColor(graphics.Color.rgb(0, 0, 64)); button.setTextColor(graphics.Color.rgb(255, 255, 255)); button.setOnClickListener(function () { button.setText("You Clicked Me!"); }) Activity.setContentView(button); } // Also try evaluating these expressions, select and run one line at a time. // Watch the result in the result area. 1 + 3 22 * 99 - 7 function twice(n) { return n * 2; } twice(22)
Device ip-address:
New Editor
Help & Download