The attached code shows how to create a Floating Menu Button, you can show the button by clicking on a button or a swipe gesture (right edge of the screen).
This is a guide that hopefully will help you write libraries in B4A.
B4A is a POWERFUL Android development tool (despite all its limitations), and is usually overlooked by some users (especially noobs and LAZY "developers")
that's why they are always asking to "wrap" libraries they found around the interwebz (Erel should consider releasing a new version called B4G (Basic For GitHub))
since apparently some users have an infatuation with code posted there and do NOTHING but wrapping those libraries no matter how simple or silly might be,
that been said, some of those libraries could be EASILY done using nothing but Good 'ol B4A code (Fact: ALL my libraries posted are written in 100% B4A),
granted, some libraries would be too difficult if not impossible to write in B4A but there's where we draw the line, what you should do is look at the library
and ask yourselves: How could I do that in B4A? and then code away and TRY IT, don't sit there waiting for someone else to write it for you or posting silly "+1"
posts requesting a wrap, if that's all you do then you will NEVER learn.
Since this is a guide, if you decide to learn and write your own B4A libraries keep in mind the following:
1- Give your libraries/classes a meaningful and descriptive name, in other words, avoid things like naming your libraries/classes like the following:
njdudeCustomButtonLibrary
b4aCustomButtonWrapper
AmazingCustomButtonBySteve
If your library deals with custom buttons then name the library CustomButton, period.
2- Use descriptive names for your methods and parameters, avoid things like the following:
Bad:
Good:
3- Add tooltips/inline help to your methods, that will make things easy to understand when using your library.
4- Use capitalization to make things more legible.
Bad:
Good:
5- Comment your source code properly.
6- Use descriptive names for variables in your source code.
7- Use proper code indentation.
8- Be consistent.
These simple guidelines will help tremendously, not only to you the library author but also other developers (if you post the source code) to learn and understand
what you did and why.
The attached code is a simple example of how B4A can be used to create amazing libraries, I have also attached the APK in case you want to see
what this is all about.
You can do whatever you want with the source code I've posted, use it as a source of inspiration to create your own B4A libraries.
B4A Rulez!!
Screenshots:
Enjoy!
This is a guide that hopefully will help you write libraries in B4A.
B4A is a POWERFUL Android development tool (despite all its limitations), and is usually overlooked by some users (especially noobs and LAZY "developers")
that's why they are always asking to "wrap" libraries they found around the interwebz (Erel should consider releasing a new version called B4G (Basic For GitHub))
since apparently some users have an infatuation with code posted there and do NOTHING but wrapping those libraries no matter how simple or silly might be,
that been said, some of those libraries could be EASILY done using nothing but Good 'ol B4A code (Fact: ALL my libraries posted are written in 100% B4A),
granted, some libraries would be too difficult if not impossible to write in B4A but there's where we draw the line, what you should do is look at the library
and ask yourselves: How could I do that in B4A? and then code away and TRY IT, don't sit there waiting for someone else to write it for you or posting silly "+1"
posts requesting a wrap, if that's all you do then you will NEVER learn.
Since this is a guide, if you decide to learn and write your own B4A libraries keep in mind the following:
1- Give your libraries/classes a meaningful and descriptive name, in other words, avoid things like naming your libraries/classes like the following:
njdudeCustomButtonLibrary
b4aCustomButtonWrapper
AmazingCustomButtonBySteve
If your library deals with custom buttons then name the library CustomButton, period.
2- Use descriptive names for your methods and parameters, avoid things like the following:
Bad:
B4X:
setparameters(v As View, t As string)
Good:
B4X:
SetProperties(TargetView As View, Title As String)
3- Add tooltips/inline help to your methods, that will make things easy to understand when using your library.
B4X:
'Title: The heading or description.
'Range: A number from 1-100.
Code(Title As String, Range As Int)
4- Use capitalization to make things more legible.
Bad:
B4X:
gettheviewtype(v As View)
Good:
B4X:
GetViewType(TargetView As View)
5- Comment your source code properly.
6- Use descriptive names for variables in your source code.
7- Use proper code indentation.
8- Be consistent.
These simple guidelines will help tremendously, not only to you the library author but also other developers (if you post the source code) to learn and understand
what you did and why.
The attached code is a simple example of how B4A can be used to create amazing libraries, I have also attached the APK in case you want to see
what this is all about.
You can do whatever you want with the source code I've posted, use it as a source of inspiration to create your own B4A libraries.
B4A Rulez!!
Screenshots:
Enjoy!
Attachments
Last edited: