
Basic4Android Rapid App Development for Android By Wyken Seagrave Published by Penny Press Ltd 176 Greendale Road, Coventry CV5 8AY, United Kingdom [email protected] Please report errors to [email protected] Copyrights Basic4Android screens copyright © 2011, 2012, 2013 Anywhere Software Other text copyright © 2013 by Penny Press Trademarks Android™ and Google Play™ are trademarks of Google Inc. Microsoft® and Visual Basic® are registered trademarks of Microsoft Corporation. The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. Notice of Rights All rights reserved. No part of this book may be reproduced or transmitted in any form by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior written permission of the publisher. To obtain permission contact [email protected] Preface Introduction Basic4Android is widely recognized as the simplest and most powerful Rapid App Development tool available for Android. It is used by tens of thousands of enthusiastic developers. A complete list of its features and benefits can be found here. Who this Book is For This book serves two audiences: For the Beginner For those new to Basic4Android, new to BASIC, or even new to programming, this book contains step-by-step tutorials for the complete beginner. It explains everything you need to know to use this exciting and easy application development environment design to create and sell your app on Android devices in the shortest possible time without having to climb the steep learning curve of learning Java. For the Professional For experienced Basic4Android developers, this book brings together a huge range of reference material never previously assembled in one place and organizes it into an easily accessible form. It contains all the key terms used by the core language and its official libraries. It includes examples to show how the code is used and links to further on-line information. What You Need to Run Basic4Android You will need a PC running Windows with at least 512 Mb of RAM. You can test your app on either an emulator (a virtual device running on your PC) or a real device. We recommend you have a real device available as it usually takes less time to install your app there than on an emulator and apps running there usually excute faster. If you use a real device it should be running Android 1.6 or above (that is Android 2.x, 3.x etc.). Version of Basic4Android This book covers the functionality of Version 3.00 of Basic4Android, which includes the amazing Rapid Debugger, a feature which is not available in any other native Android development tool. How to Obtain this Book You can buy copies of this in book in various formats. As a Kindle book from the Amazon USA site go here. - iv - Preface As a PDF or EPUB document from the Penny Press store go here. The EPUB version will also be available from the Barnes & Noble web store. How this Book is Organized Part 1 – Basics We begin with a tutorial which walks you gently through the process of installing the free Trial Version of Basic4Android, connecting it to your device, then writing, running, designing and debugging your very first Android app. We explain every feature of the Integrated Development Environment and show you how to upgrade to the Full Version of Basic4Android. This will give you access to the Libraries discussed in Part 4. Part 2 – Creating Your App Here we go in detail through the process of creating a real app, including the principles of design, how your app can communicate with the user, how you can use Designer Scripts to automatically modify your app to suit different devices, and how to compile, debug and test your app using either real or virtual devices. We discuss creating graphics and databases. We examine how processes, services and activities live and die in Android. We look at the various types of modules you can create, examine ways you can make money from your app and finally explore ways you can get more help in using Basic4Android. Part 3 – Language and Core Objects Parts 3 and 4 form the reference sections of this book. Part 3 includes two chapters of reference material which cover every part of Basic4Android’s language and core objects (that is, objects accessible from every app). We also compare Basic4Android’s language with Microsoft’s Visual Basic. Part 4 – Libraries In this reference section we discuss libraries (only available if you have upgraded to the Full Version of Basic4Android), and explain how to create your own libraries and share them with others (should you wish to). We give full details of the Standard Libraries included in the Full Version installation. We also discuss some of the many Additional Libraries and Modules, including all the “Official” ones created by Anywhere Software, which you can download from the Basic4Android website. Conventions Used in this Book Code Examples of Basic4Android code are shown indented, like this: - v - Preface Icons The following icons are used in this book and within the IDE: Keywords and methods have a pink flying box Key constants have a blue box Functions defined in your code have a pink box with a lock Global variables (defined in Process_Globals) have a blue box with a key Local variables (defined in current Sub) have a blue box with a lock Properties have a hand pointing to a list Acronyms We use the following acroynms in this book: ADB Android Debug Bridge AES-256 Advanced Encryption Standard ANSI American National Standards Institute API Application Program Interface APK Filename extension for Android Package .APK Android Package (filename extension) ARGB Alpha,Red,Green,Blue (Color Specification) ASCII American Standard Code for Information Interchange AVD Android Virtual Device B4A Basic4Android BA A Basic4Android object which library developers can use to raise events and to get access to the user activity, application context and other resources. .BAS Filename extension for BASic files BASIC Beginner’s All-Purpose Symbolic Instruction Code BOM Byte Order Mark C2DM Cloud To Device Messaging CPU Central Processing Unit CSV Comma-Separated Values DBMS DataBase Management System dip density independent pixel DOS Disk Operating System dpi dots per inch DSA Digital Signature Algorithm DTMF Dual-tone multi-frequency EAS Embedded Audio Synthesizer .EXE Filename extension for an EXEcutable file FTP File Transfer Protocol GMT Greenwich Mean Time GPS Global Positioning System GPU Graphics Processing Unit HD High Definition HDPI High-density Dots Per Inch HSV Hue, Saturation and Value (Color Specification) - vii - 1.1 Getting Started 1.1 Getting Started Note: Basic4Android runs on PCs with Windows 2000 and above, including Windows 8. Both 32-bit and 64-bit systems are supported. Two Versions There are two versions of Basic4Android: the trial and the full version. The main differences are in brief: Price: the trial version is FREE! The price of the full version depends upon which flavor you purchase. Remote Compilation Mode which makes compiling your apps simple and painless only runs under the free trial. This means you do not need to install the Java JDK and Android SDK packages if you are running the free version, although you may if you wish. They are both required for the full version. Note that Basic4Android includes a Rapid Debugger which can greatly shorten development times. You can use this feature with both the trial and full versions, but in both cases it requires that you install the Java JDK, even when you use Remote Compilation with the trial version. Advanced features: the full version supports libraries and other advanced features missing from the trial. Installing the Trial Version In the tutorials, we assume you will be using the free trial version of Basic4Android. We also assume you will not want to install the Java JDK to begin with, so we will postpone explanation of the Rapid Debugger until Chapter 2. Download Basic4Android Trial Download the latest version of the Basic4Android Trial version from here: http://www.basic4ppc.com/android/downloads.html Install and Run the Trial Installing .NET Framework Basic4Android requires .NET Framework 3.5. If it is not present on your machine, you will be prompted to download and install it. - 12 - 1.1 Getting Started After you run the Trial, you will see this screen: We will say more about local and remote compilation soon. Click Close You then see the IDE (Integrated Development Environment). - 13 - 1.1 Getting Started This is where you create, test and compile your apps. Apps are developed within projects and projects are stored in folders. Your First App When you create a new Basic4Android app, a sample project is already loaded, allowing you to run this simple app without any additional code. The code should be as follows. If your code is different, you can either copy this or edit your code to be the same, or download “Your First App” from this book’s resource page and unzip it to a new folder within your projects folder. - 14 - 1.1 Getting Started #Region Project Attributes #ApplicationLabel: B4A Example #VersionCode: 1 #VersionName: 'SupportedOrientations possible values: unspecified, landscape or portrait. #SupportedOrientations: unspecified #CanInstallToExternalStorage: False #End Region #Region Activity Attributes #FullScreen: False #IncludeTitle: True #End Region Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. End Sub Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages60 Page
-
File Size-