Basic4android, with independent IDE, powerful libary covers Android SDK, compile and generate native APK package and JavaCode. Supports WYSIWYG layout, allowing you to focus only on business logic for rapid development.
Environment Installation
1) install basic4android and download the free version on the official website. The paid version provides more functions.
2) real machine installation B4A-Bridge, connected to the real machine debugging, simulator does not need
3) install JDK
4) install the android SDK (the path should not contain spaces)
Configure the SDK and download the required package (platform-tools, 2.2 SDK, USB)
5) configure the android SDK path and JDK path in basic4android
Tools-> Configure paths
Simulator Configuration
1) Configure AVD
You can create a new virtual device. Select Start to start the simulator.
Hello word
1) Start IDE, add the following line of code to save the project, and set the project/package name sub-Name (d4a. Starts with lowercase)
SubActivity_create (firsttimeAs Boolean)Msgbox("Hello, basic for Android","Test")End sub
2) Start F5 and start compiling
Running effect after being deployed to the simulator
3) Physical Structure of code files
Files
| ----. Bal (layout file), resource file, etc.
Objects
| ---- APK package and Java code are generated only during compilation
Hello. b4a code file, a module File (similar to a Windows form, but not necessarily the interface layout, a panel can also load layout)
Lifecycle
When creating an activity module, IDE automatically creates the following code:
# 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 # Shortdetitle: True # End Region Sub Process_globals ' ApplicationProgramLevel global Parameters End sub Sub Globals ' The parameters used in this module are defined here End sub Sub Activity_create (firsttime As Boolean ) ' Activate this module (page) End sub Sub Activity_resume ' Leave End sub Sub Activity_pause (userclosed As Boolean ) ' Restore End sub
IDE
1) four options in the lower right corner
Modules: Display Module name and function name
Files: files (resources) under the files directory)
Logs: log information output
Libs: select the databases to use. These libraries can be used in the code without the need for using or import.
2) Smart notification
3) Automatic completion
CTRL + space, or select a-> In the toolbar
Visual Interface Design
Select "designer" from the menu bar"
Designer/tools-> connect to device/emulator
Connect to the Simulator Design. Here is a virtual visual interface and a Simulator Interface.
Under "add View", select the control you want to add and change its properties, as shown in figure
File/save, save it as a. Bal file (in the files directory), and then you can display the layout in the code.
SubActivity_create (firsttimeAs Boolean) Activity. loadlayout ("Layout1")End sub
Tools/generate members: select the required control and event name to automatically generate the corresponding code, such:
SubGlobalsDimButton1AsButtonDimEdittext1AsEdittextEnd subSubButton#clickEnd sub
A complete example
As a simple blog news client, you can view and view news. It is only a demo, and the application itself has no value. HTTP components and regular expressions are used for core functions, and listview and webview are used for display.
Attachment APK installation package http://dl.vmall.com/c0vza06nf1