Page 1 of 1

How to create an Android application

Posted: Mon Mar 26, 2018 5:17 pm
by falsam
Create an Android application.

Installing the JDK 1.8
Link ... 33151.html

Configuring the IDE: Specify the JDK installation folder.
IDE : Menu file ➽ Preference ➽ Compiler


Configure the application.
Prepare your first code and save it.
Code: Select all

Declare Start()
Declare ShowTime()

;No debug


Procedure Start()
  LoadFont(#mfFont, "", 50)
  OpenWindow(#mf, 0, 0, 0, 0, "", #PB_Window_Background)
  TextGadget(#mfTime, 10, 100, 300, 50, "00:00:00")
  SetGadgetFont(#mfTime, FontID(#mfFont))
  AddWindowTimer(#mf, 0, 1000)
  BindEvent(#PB_Event_Timer, @ShowTime())

Procedure ShowTime()
  Protected Time.s = FormatDate("%hh:%ii:%ss", Date())
  SetGadgetText(#mfTime, Time)

It's time to set up your Android application.

Configuring the APK: An android application has the.apk extension
IDE : Menu Compiler ➽ Create App


App Name : Name that will appear when installing the apk.

Version : Version of your application. To be incremented with each generation of the APK. Example : 1.0.0

Package id (lower case): Identifier of the Android application.
Package name :

:idea: .android is optional.

You don't have to have a domain to publish an application. You can take for example your nickname on this forum.
Example : com.falsam.firstapplication

Outfile Filename : Application name for Android.

Ok button to save the configuration.
Create App button to create the Android application.


With this example, I transferred the final apk to a tablet and smartphone manually via the usb cable.

Transfers of unknown applications.
Installing unknown applications (Internet, alternative store, USB transfer, etc...) requires changing phone settings to allow applications from unknown sources.

Mobile : Parameters ➽ General tab ➽ Security: Check Unknown sources.

Re: How to create an Android application

Posted: Mon Mar 26, 2018 5:22 pm
by falsam
If you have successfully created your first application for Android (YeahhHHhhhh), I suggest you test this code to turn on or off your terminal's lamp.


Re: How to create an Android application

Posted: Tue Mar 27, 2018 6:16 pm
by munfraid
Thanks, falsam, for this sample and instruction - very helpful! I love all the things you share here and yet learned a lot from them.

Merci, falsam, pour cet exemple et cette instruction - très utile ! J'aime toutes les choses que vous partagez ici et pourtant j'ai beaucoup appris d'eux.

Re: How to create an Android application

Posted: Mon Apr 02, 2018 9:31 am
by tj1010
This tutorial already exists here, but IAP is the in app purchases key you get from your store panel, and package ID is a unique identifier on store and is used for nothing else; there is a bug with it and webview in older Android versions, but it's probably worked around by the SB team. There is a signing tool in the how-to-sign thread.

Re: How to create an Android application

Posted: Thu Mar 28, 2019 3:10 pm
by Peter53
Sadly I can't get it to compile to Android.
At 60%, I get the 'app build failed' message.
I'm using SB 2.21, Windows 10.
Downloaded and installed Java jdk-8u202-windows-i586.exe from here: ... 33151.html (Tried defferent versions).
I've set the JDK path to "C:\Program Files (x86)\Java\jdk1.8.0_202\"
Any help is truly appreciated.

Re: How to create an Android application

Posted: Sat Jun 01, 2019 9:18 am
by Dan23
I have the same problem: Invalid Version: broken! under the same conditions.
Whatever the program.
Where does this error come from?.
Spider Basic? of a bookstore?, yes but which one?
At 40%, I receive the message "app build build failed".
After each trial, I am forced to restart SpiderBasic.
I use SB 2.21 (x86, impossible to get 64 bits).Paid version
Windows 7 Pro Pack 1.
JDK path to "C: \ Program Files \ Java \ jdk1.8.0_211 \"
"Enable debugger" is enabled.
Everything seems correct. It's very frustrating.
Thank you

Re: How to create an Android application

Posted: Wed Jun 05, 2019 6:58 pm
by MetalOS
Hi Falsam,

you will have an example of android application but with several windows. A simple trick to see how to manage multiple windows I'm looking for nothing more.

Thank you in advance.

Re: How to create an Android application

Posted: Wed Jun 05, 2019 10:19 pm
by falsam
Hi MetalOS

No real window in an apk (except for a tablet application).

Navigation between windows will be done through containers.

This little code doesn't record any data. It is a simple demonstration of navigation between two windows.
Code: Select all
Enumeration font

Enumeration window

Enumeration gadget

Global width, height

Declare Start()
Declare TodoList()
Declare TodoNew()
Declare TodoAdd()


Procedure Start()
  ; Really close the debug window
  ; Font
  LoadFont(#GlobalFont, "Arial", 16)
  LoadFont(#TitleFont, "Arial", 20)   
  SetGadgetFont(#PB_Default, FontID(#GlobalFont))
  ; Background window
  OpenWindow(#mf, 0, 0, 0, 0, "", #PB_Window_Background) 
  width = WindowWidth(#mf)
  height= WindowHeight(#mf)
  ; Title
  TextGadget(#mfTitle, 5, 5, 200, 24, "Todo List")
  SetGadgetFont(#mfTitle, FontID(#TitleFont))
  ; First page
  If ContainerGadget(#mf0, 0, 30, width, height)
    ListViewGadget(#mfTodoList, 5, 0, width - 10, height - 100)
    ButtonGadget(#mfNewItem, 5, height - 70, width - 10, 24, "New item")
  ; Second page
  If ContainerGadget(#mf1, 0, 30, width, height)
    StringGadget(#mfTodo, 5, 0, width - 10, 24, "")
    ButtonGadget(#mfAddItem, 5, height - 70, width - 10, 24, "Add item")   
  BindGadgetEvent(#mfNewItem, @TodoNew())
  BindGadgetEvent(#mfAddItem, @TodoAdd())

Procedure TodoList() 
  HideGadget(#mf0, #False)
  HideGadget(#mf1, #True)

Procedure TodoNew()
  HideGadget(#mf0, #True)
  HideGadget(#mf1, #False)
  SetGadgetText(#mfTodo, "Item " + Str(CountGadgetItems(#mfTodoList))) 

Procedure TodoAdd()
  Protected buffer.s = GetGadgetText(#mfTodo)
  AddGadgetItem(#mfTodoList, -1, Buffer)
The listview is scrolled with the finger ^^


Re: How to create an Android application

Posted: Thu Jun 06, 2019 2:56 pm
by MetalOS
Nickel, Merci Falsam.