小白用VB开发安卓程序_1认识B4A

这是B4A v12.8的工作环境 


2024.04.16 为止,最新版本是 v12.8(自带简体中文语言包)

       Basic4android(简称B4A)是一个简单,然而功能非常强大的Android应用开发环境,虽然它来自欧洲,但在2022年左右已自带中文简体语言包,整个开发界面是简体中文的,整个开发工具是免费的,不需要收费。Basic4android语言类似于Visual Basic语言,支持更多的对象。Basic4android将代码编译成Android原生(native)应用,无需其它运行环境的支持。与其它的集成开发环境不同,Basic4android是完全用于Android应用开发的开发工具,不支持其它平台。Basic4android包含一个强大的GUI设计器,内建对多屏和坐标的支持,不需要开发者再写XML。开发者可以在Basic4android环境下利用Android模拟器或Android物理设备(利用USB连接或通过本地网络连接)进行程序开发和调试。

      Basic4android带有丰富的库函数,支持所有的Android 核心特性,因而使其非常容易进行高级应用开发。这些库函数包括:SQL数据库、GPS、串口(蓝牙)、照相机、XML、JSON、Web服务(HTTP)、后台服务、动画、网络(TCP和UDP)、文本阅读(TTS)和声音识别、Web浏览、移动电话广告(AdMob)、图表、OpenGL、图像,等等。与Eclipse一样,B4A编译出来的编程是伪编译的,即安卓手机上运行这些编译出来的程序时,是解析执行的。因为JAVA本身就是伪编译。

       目前智能手机软件方兴未艾,而智能手机中安卓手机占了智能手机市场的70%到80%,苹果手机占智能手机的20%。安卓开发工具中B4A是一款类似BASIC语言的小众化开发工具,很适合BASIC语言的人快速入门。
 

B4A官网 https://www.b4x.com 

如果对英文不怎么熟悉,可以 使用百度提供的在线网页翻译,对英文网页进行翻译。

  • 7
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1 Getting started........................................................................................................................7 1.1 Installing Basic4Android and Android SDK ....................................................................7 1.1.1 Install and configure Basic4Android ........................................................................9 1.2 Installing Android Emulator........................................................................................... 10 2 My first program (MyFirstProgram.b4a)............................................................................... 15 3 Second program (SecondProgram.b4a) ................................................................................. 33 4 The IDE ............................................................................................................................... 46 4.1 Menu and Toolbar.......................................................................................................... 47 4.1.1 Toolbar .................................................................................................................. 47 4.1.2 File menu ............................................................................................................... 48 4.1.3 Edit menu............................................................................................................... 48 4.1.4 Project menu .......................................................................................................... 49 4.1.5 Tools menu ............................................................................................................ 50 4.2 Code area....................................................................................................................... 52 4.2.1 Undo – Redo ............................................................................................. 52 4.2.2 Collapse a subroutine ............................................................................................. 52 4.2.3 Collapse a Region .................................................................................................. 53 4.2.4 Collapse the whole code......................................................................................... 54 4.2.5 Commenting and uncommenting code ...................................................... 55 4.2.6 Bookmarks .................................................................................. 55 4.2.7 Indentation ............................................................................................... 56 4.2.8 Autocomplete ................................................................................................. 58 4.2.9 Jump to a subroutine .............................................................................................. 60 4.2.10 Highlighting occurences of words .......................................................................... 61 4.2.11 Debugging ............................................................................................................. 62 4.2.12 Breakpoints............................................................................................................ 64 4.3 Tabs.............................................................................................................................. 67 4.3.1 Module and subroutine lists ............................................................... 67 4.3.2 Files ....................................................................................................... 68 4.3.3 Logs ...................................................................................................... 69 4.3.4 Libs ........................................................................................................ 70 5 Screen sizes and resolutions................................................................................................... 71 5.1 Specilal functions like 50%x, 50dip ............................................................................. 76 5.1.1 PerXToCurrent, PerYToCurrent - 50%x................................................................. 76 5.1.2 DipToCurrent - 50dip............................................................................................. 76 6 The Emulator........................................................................................................................ 77 6.1 Launch an Emulator....................................................................................................... 77 6.2 Generate a new Emulator............................................................................................... 79 6.3 Emulator problems......................................................................................................... 81 6.3.1 Process timeout ...................................................................................................... 82 7 B4A Bridge ........................................................................................................................... 83 8 The Designer ......................................................................................................................... 86 8.1 The menu....................................................................................................................... 87 8.1.1 File menu ............................................................................................................... 87 8.1.2 AddView menu ...................................................................................................... 87 8.1.3 The Tools menu ..................................................................................................... 88 8.2 Tools ............................................................................................................................. 89 8.2.1 Generate Members ................................................................................................. 89 8.2.2 BringTo Front ........................................................................................................ 90 Table of contents 3 Basic4Android Beginner's Guide 8.2.3 Duplicate Selected View ........................................................................................ 90 8.2.4 Remove Selected View .......................................................................................... 91 8.2.5 Change grid............................................................................................................ 91 8.2.6 Connect device or emulator.................................................................................... 92 8.3 General settings ............................................................................................................. 92 8.4 Image files ..................................................................................................................... 93 8.5 Properties list ................................................................................................................. 94 8.6 Layout variants .............................................................................................................. 96 8.7 The Abstract Designer ................................................................................................. 101 8.7.1 The menu ............................................................................................................. 102 8.7.2 Example............................................................................................................... 103 8.8 Adding views by code.................................................................................................. 106 9 Process and Activity life cycle............................................................................................. 109 10 Variables and objects....................................................................................................... 113 10.1 Variable Types............................................................................................................. 113 10.2 Names of variables ...................................................................................................... 114 10.3 Declaring variables ...................................................................................................... 114 10.3.1 Simple variables................................................................................................... 114 10.3.2 Array variables..................................................................................................... 115 10.3.3 Array of views (objects) ....................................................................................... 117 10.3.4 Type variables...................................................................................................... 118 10.4 Casting ........................................................................................................................ 119 10.5 Scope.......................................................................................................................... 120 10.5.1 Process variables.................................................................................................. 120 10.5.2 Activity variables ................................................................................................. 120 10.5.3 Local variables..................................................................................................... 120 10.6 Tips ............................................................................................................................. 121 11 Modules.......................................................................................................................... 122 11.1 Activity modules.......................................................................................................... 123 11.2 Code modules .............................................................................................................. 124 11.3 Service modules........................................................................................................... 125 12 Example programs........................................................................................................... 126 12.1 User interfaces ............................................................................................................. 126 12.1.1 Menu example (UserInterfaceMenu.b4a)............................................................. 127 12.1.2 TabHost example (UserInterfaceTabHost.b4a) ................................................... 128 12.1.3 Button toolbox example (UserInterfaceButtonToolbox.b4a)................................ 129 12.2 Program with 3 Activities (ThreeActivityExample.b4a) .............................................. 130 12.3 ScrollView examples ................................................................................................... 137 12.3.1 ScrollView example program............................................................................... 138 13 SQLite Database.............................................................................................................. 149 13.1 SQLite Database basics................................................................................................ 149 13.2 SQLite Database example program.............................................................................. 152 13.2.1 Editing ................................................................................................................. 154 13.2.2 Filtering ............................................................................................................... 155 13.2.3 Beginning of the code .......................................................................................... 156 13.2.4 Read the table ...................................................................................................... 159 13.2.5 Modify a data set.................................................................................................. 161 13.2.6 Add a data set to the database............................................................................... 162 13.2.7 Delete a data set from the database....................................................................... 164 13.2.8 Positioning of the EditText Views in the Edit panel.............................................. 165 14 GPS................................................................................................................................ 166 14.1 GPS Library................................................................................................................. 166 14.1.1 GPS Object .......................................................................................................... 166 Table of contents 4 Basic4Android Beginner's Guide 14.1.2 GPS Satellite........................................................................................................ 167 14.1.3 GPS Location....................................................................................................... 167 14.2 GPS Program............................................................................................................... 168 14.2.1 General explanations............................................................................................ 171 14.2.2 Setup.................................................................................................................... 172 14.2.3 GPS display ......................................................................................................... 173 14.2.4 Satellites .............................................................................................................. 174 14.2.5 Map display ......................................................................................................... 175 14.2.6 GPS path.............................................................................................................. 177 14.3 GPS Program Code...................................................................................................... 181 14.3.1 Initialization of the GPS....................................................................................... 182 14.3.2 Button with tooltip ............................................................................................... 183 14.3.3 Button with tooltip and additional buttons ............................................................ 186 14.3.4 GPS Calculate distance scales .............................................................................. 189 14.3.5 Drawing GPS position.......................................................................................... 190 15 Basic language................................................................................................................. 193 15.1 Program flow............................................................................................................... 193 15.1.1 Process_Globals routine ....................................................................................... 193 15.1.2 Globals routine..................................................................................................... 194 15.1.3 Activity_Create (FirstTime As Boolean) routine .................................................. 194 15.1.4 Activity_Resume routine...................................................................................... 194 15.1.5 Activity_Pause (UserClosed As Boolean) routine................................................. 194 15.2 Expressions.................................................................................................................. 196 15.2.1 Mathematical expressions .................................................................................... 196 15.2.2 Relational expressions.......................................................................................... 197 15.2.3 Boolean expressions............................................................................................. 197 15.3 Conditional statements................................................................................................. 197 15.3.1 If – Then – End If................................................................................................. 198 15.3.2 Select – Case........................................................................................................ 199 15.4 Loop structures ............................................................................................................ 201 15.4.1 For – Next............................................................................................................ 201 15.4.2 Do - Loop ............................................................................................................ 202 15.5 Subs............................................................................................................................ 203 15.5.1 Declaring ............................................................................................................. 203 15.5.2 Calling a Sub........................................................................................................ 203 15.5.3 Naming ................................................................................................................ 203 15.5.4 Parameters ........................................................................................................... 204 15.5.5 Returned value ..................................................................................................... 204 15.6 Events......................................................................................................................... 205 15.7 Libraries ...................................................................................................................... 208 15.7.1 Standard libraries ................................................................................................. 208 15.7.2 Additional libraries folder .................................................................................... 208 15.7.3 Error message "Are you missing a library reference?" .......................................... 209 15.8 String manipulation ..................................................................................................... 210 15.9 Timers ......................................................................................................................... 211 15.10 Files......................................................................................................................... 212 15.10.1 File object ........................................................................................................ 212 15.10.2 TextWriter........................................................................................................ 214 15.10.3 TextReader....................................................................................................... 215 15.10.4 Text encoding................................................................................................... 216 16 Graphics / Drawing.......................................................................................................... 218 16.1 Overview..................................................................................................................... 218 16.2 Drawing test programs................................................................................................. 220 Table of contents 5 Basic4Android Beginner's Guide 16.2.1 Drawing rotating bitmaps / RotatingNeedle.......................................................... 220 16.2.2 Simple draw functions.......................................................................................... 225 17 Widgets, home screen widgets ......................................................................................... 234 17.1 Widgets Part I............................................................................................................. 234 17.2 Widgets Part II............................................................................................................ 237 18 B4A Keywords................................................................................................................ 240 18.1 Bit ............................................................................................................................... 240 18.2 DateTime..................................................................................................................... 241 18.3 Exception..................................................................................................................... 244 18.4 Keywords .................................................................................................................... 245 18.5 LayoutValues............................................................................................................... 257 18.6 String.......................................................................................................................... 258 18.7 StringBuilder ............................................................................................................... 260 18.8 Timer.......................................................................................................................... 262 19 Views .............................................................................................................................. 264 19.1 Activity....................................................................................................................... 264 19.2 Button......................................................................................................................... 268 19.3 CheckBox.................................................................................................................... 271 19.4 EditText....................................................................................................................... 274 19.5 ImageView .................................................................................................................. 279 19.6 Label ........................................................................................................................... 282 19.7 ListView...................................................................................................................... 285 19.8 Panel........................................................................................................................... 290 19.9 ProgressBar ................................................................................................................. 293 19.10 RadioButton............................................................................................................. 295 19.11 ScrollView............................................................................................................... 298 19.12 SeekBar ................................................................................................................... 301 19.13 Spinner .................................................................................................................... 304 19.14 TabHost ................................................................................................................... 308 19.15 ToggleButton........................................................................................................... 312 19.16 View........................................................................................................................ 315 19.17 WebView................................................................................................................. 317 20 VB6 versus B4A.............................................................................................................. 321 21 FAQ ............................................................................................................................... 326 21.1 "Please save project first" message............................................................................. 326 21.2 "Are you missing a library reference" message........................................................... 326 21.3 How loading / updating a library.................................................................................. 327 21.4 When do we need to 'Initialize' and when not............................................................. 327 21.5 Split a long line into two or more lines......................................................................... 328 21.6 Avoid closing an application........................................................................................ 328 21.7 Unwanted events like Click, Touch or others ............................................................... 329 21.8 Adding a Menu item.................................................................................................... 329 21.9 How do I remove a View with the Designer................................................................. 330 21.10 "Process has timeout" message............................................................................... 330 21.11 Getting a picture from the gallery............................................................................. 331 21.12 How to delete x.bal files or other files from a project ............................................. 331 21.13 Block a screen orientation ........................................................................................ 332 21.14 Close second Activity .............................................................................................. 333 21.15 Taking a screenshot programaticaly ......................................................................... 333 21.16 After compiling, where are the files ......................................................................... 333 21.17 Run an application from another one........................................................................ 334 21.18 How to pass an Array to a Sub ................................................................................. 334 21.19 Getting language and country from device ............................................................... 335 Table of contents 6 Basic4Android Beginner's Guide 22 Glossary .......................................................................................................................... 336

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值