======Sample DroidScript Code====== ====Sample programs==== [[Dice]]- This is a simple dice game. \\ [[Digital Clock]]- Shows Time and date. \\ [[DroidScript Console]]- Similar to command prompt in Windows. \\ [[Filter]]- This sample shows how to filter items in a list. \\ [[Battery Level]]- Shows Battery Level. \\ [[App Update]] - Check if an update for the app is available\\ [[Torch]] - This is a simple flashlight app. \\ [[Volume Box]] - You can view and adjust volume on your device\\ [[sample_code:backup_apps|Backup Apps as Zip]] - Shows how to Backup your Appfolder as Zip file\\ [[sample_code:button_styles|Custom Buttons]] - Button Styles sample provided with DroidScript\\ [[sample_code:cameraview_color effect|CameraView Colour Effects]] - Demo available colour effects\\ [[dateDiff|Date Difference]] Displays the difference between two dates as Years, months days\\ [[dialogbox|Dialogbox]] - Sample how to create a simple Dialog\\ [[sample_code:drawing|Drawing demo]] - Simple drawing demo\\ [[sample_code:draw_smiley|Draw smiley]] - Use Canvas Drawing Function To Draw A Smiley\\ [[sample_code:view_sys_files|Display /Sys resources]] - Show included images and sounds \\ [[extra_keys|Extra Keys]] - Help! It's really difficult to get to the curly braces on my keyboard!\\ [[sample_code:file_picker|File Picker]] - Sample for a Filepicker\\ [[sample_code:folder_picker|Folder Picker]] - Sample for a Folderpicker\\ [[sample_code:get_device_specs|Get Device Infos]] - Send your Deviceinfos to clipboard\\ [[sample_code:decimal_input|Decimal Values in a Textedit]] - Allows just decimal values in a textedit\\ [[sample_code:numeric_input|Get Number in a Textedit]] - Test if a value in a Textedit is a number\\ [[img_toggle_button|Image Toggle Button]] - Take a image as toggle Button\\ [[sample_code:image_pixel_color|Image Pixel]] - Show colour of touched pixel\\ [[sample_code:image_array|Image array]] - store value of clicked rectangles in 2d array\\ [[https://groups.google.com/forum/m/#!topic/androidscript/g4VpOACZve0|Control an image]] - great sample by Dirk using image.DrawImageMtx\\ [[sample_code:image_rotate|Image rotate]] - rotate x×y images using image.DrawImageMtx\\ [[sample_code:layout_children|Layout Children]] - Functions to manipulate controls on a layout\\ [[sample_code:list_of_entries|List of Entries]] - Show a list of entries (with add, update, delete, save, load)\\ [[sample_code:listing_nxt_files|Listing files on NXT]] - Sample app\\ [[sample_code:random_file_acces|Low Random File Acces]] - Sample and Infos from Dave Smart\\ [[introspector|Method finder]] - Introspection lite tool for home use by Steve Garman\\ [[pincode|Pincode]] - Excellent pincode entry facility with optional hidden input\\ [[passwordvault|Password Vault]] - Store your passwords (protected by FingerPrint scan and Master Password\\ [[Sample_code:app_toback|Send App to Back]] - Sample how to send your App to the Background and restart it\\ [[sample_code:shake|Shake]] - Use accelerometer to detect device shaken\\ [[Sample_code:simulate_touch|Use SimulateTouch]] - Sample to show how you can use the app.SimulateTouch method\\ [[sample_code:slide_menu|Slide Menu]] - swipe to close\\ [[unit_convert|Unit Conversion]] - Simplistic unit-conversion demo\\ [[visitor_log|Visitor log]] - Full working example of a visitor sign-in log for my workplace\\ [[sample_code:sample_web_view|Web View]] - Simple webview demo\\ [[sample_code:get_webpage_content|Load Webpage content]] - Shows how to load a webpagetext into a variable\\ [[sample_code: sample_xmlhttprequest|Sample XMLHttpRequest]] - simple Roku remote demonstrates XMLHttpRequest\\ [[sample_code:superuser|superuser on rooted device]]\\ [[sample_code:shell|shell access]]\\ [[sample_code:listroots|list writeable mounted paths]] - List free space on mounted writeable paths\\ [[sample_code:Using app.Execute]] - How to use app.Execute to get DS to respond to buttons/links etc in a Webview\\ [[sample_code:file_service|Website File Check Service]] - Service to keep checking whether a file on a webserver has changed\\ ---- ====Dialogs - ready to use==== [[sample_code:about_dialog|About Dialog]] - Show a simple Dialog to display some infos\\ [[sample_code:colorpicker|Colorpicker]] - Pick a color and take the Hex-Colorcode result for formating or in your code\\ [[sample_code:fontawesomepicker|FontAwesomepicker]] - Pick a icon and take the name of it as text or in your code\\ [[sample_code:new_file|New File Dialog]] - Show a dialog and create a new file in a folder\\ [[sample_code:new_folder|New Folder Dialog]] - Show a dialog and create a new folder in the path\\ [[inputbox|Dialog for user input]] Get a string from the user\\ [[sample_code:custom_dialog|Custom Yes-No Dialog]] - Sample how to create a simple custom dialog, displayed if Back-Button is touched\\ [[sample_code:database_navigate|Navigate Droidscript Databases]] First draft to navigate multidatabases, tables, columns and see values.\\ ---- ====Snippets, Functions==== [[Count List-Items]] - a function to count the items in a list-control\\ [[List Folders and Subfolders]] - All folders and subfolders in a list-control\\ [[Sort List]] - sort a List\\ [[Spinner GetSelectedItemNumber]] - Get the Number of the selected Spinner Item\\ [[Tab-Select]] - shows how you can select a Tab with an button command\\ [[Unzip Folders]] - a function to unzip folders to an path\\ [[sample_code:json_funcs|JSON functions]] - Store objects in text files\\ [[sample_code:textedit_search|TextEdit Search]] - Search for string in a TextEdit control \\ [[sample_code:hexview|File Hex Viewer]] display a file in hex\\ [[sample_code:Search |]] search \\ ---- ====Samples on the forum==== [[forum_sample_links|Links to samples]] on the official DroidScript forum ---- ====Tips and Tricks==== You can look [[tips_tricks:start|here for some Tips and Tricks]] ---- ===Note for contributors=== If you wish to create a new page in the **Sample Code** namespace, please create a link to the new page above, save this page and click on the link you just created.