Android Tutorial The super quick way to knock-up a test app!

With thanks to NJDude who helped me with the designer script.

Say you have a function or a class that isn't working right and you need some help from the forums. Its a good idea to include a small test app so that we can all load it up and see exactly whats going on.

Here's how to make a quick test app from scratch in about 1 minute :)

1) Open Basic for Android, if you don't have a new project then click File > New

2) Click on the Save icon, navigate to a folder where you would like to save your app, click on New Folder and make a new folder, lets call it QuickTestApp, hit return then double click on your new folder to go into it, name your new project QuickTestApp in the 'FileName' field and click Save

3) Under the Project Attributes change the #ApplicationLabel: from B4a Example to QuickTestApp then do Ctrl S to save

4) un-comment the Activity.LoadLayout("Layout1") line

5) Click on Designer in the menu then 'Add View' and add a panel.
Make it so its about half the height of the designer (my designer opens with the 320 x 480, scale = 1 properties) and nearly the width of the designer and put it halfway down in the middle.

6) In the Designer un-comment AutoScaleAll and add this line:
Panel1.HorizontalCenter = 50%x
Remember X is a Cross (across)
and add this line:
Panel1.VerticalCenter = 50%y

Now if you have the Abstract designer in view when you click on 'Run Script'
you will see your panel move slightly to be in the exact middle, this will be in the exact middle in landscape view as well!

7) Click on the panel so that when you add more Views their parent will be the panel then AddView a Label... you have to click on the 'Main' tab in the designer first or it won't let you add a view :)

So more accurately, click the Main tab then click on the label (it gets selected and shows you sizing handles) and then click Add View and add a Label.

8) Stretch the label to nearly the whole width of the panel then in the label's properties:
Click on Text Style (the + icon expands to show you the properties)
change Horizontal Alignment to CENTER_HORIZONTAL
incidentally you can stretch the designer dialog box to see all the text..

Set the label's text color to Black
in the Text part write 'Press the button and look in the logs' then hit return

9) Click on the panel again and AddView a button

Move it and size it central to under the label and change its text color to black (like you did the label) and maybe add some text like 'Click Me' or something.

Now click on File > Save and call it Layout1 so that its the same as you're going to load in your Main code.

10) Now click on Tools > Generate Members and click on the + sign next to the button and put a tick in the 'click' box then click on the Generate Members button and it will put a new subroutine in your main activity called:

Sub Button1_Click

Now write some code in that sub like:

Sub Button1_Click
   Log("Wow, that was quick!")
   ToastMessageShow("Indeed it was!", False)
End Sub

Run your new app.

How fast can you do all that?

Do you think you can commit this entire process to memory for making quick test apps?

Remember to save your Designer layout each time you make a change.

you can use the File > Export as Zip option in B4a to save your whole project to a zip file to upload it here for help....

I did :) (but I misspelt it :) )


    7.1 KB · Views: 423
Last edited:


Well-Known Member
Licensed User
Longtime User
Thanks Alex!

Just out of curiosity, is there any other dev system in the world where you can make an Android app from scratch that quickly without having to load something up that you've already made?