B4ASnippetCRC
CRC CCITT (xFFFF) Calculation
CRC CCITT (0xFFFF) calculation on https://www.lammertbies.nl/comm/info/crc-calculation.html
@Victor Pavlov · 2018-02-16
B4ASnippetToast
Custom Toast Message
You can customize the toast message text with CSBuilder: https://www.b4x.com/android/forum/threads/76226/#content This code allows you to also change the background color and the toast position
@Erel · 2018-02-11
B4ASnippetGoogle
Check and install Google Play Services
This code will check that an updated version of Google Play Services is installed on the device. If not then it will try to help the user install it.
@Erel · 2018-02-05
B4ASnippetMail
Sending email via SMTP with POP before SMTP
The emailing (via SMTP) trouble is solved: to avoid server auth error before using SMTP server we have to check email, say by POP3. This class is tested during 3 days on popular app with around 70-80 emails from an app to the chosen GMAIL box to self. No sending errors now. Before there were 2-3 sending errors per day.
@peacemaker · 2018-01-22
B4ASnippetFirebase
Get Firebase config parameters from google-services.json
Code to get configuration parameters from google-services.json
@fredo · 2018-01-17
B4ASnippetAction Bar, Drawer, etc
SetNavigationBarColor - Change code of Navigation Bar by Code
I use this function to change color of the Navigation Bar (SDK > 21 = Android 5+) in some screens of my app that use Theme.Holo.Light.
@asales · 2018-01-16
B4ASnippetColour
Designer Colours
These are the colours used in the designer which has a very nice drop down pickable list together with names.
@PhiloSophical · 2018-01-08
B4ASnippetStrings
Binary2String
String to Binary and Binary to String.
@ilan · 2018-01-05
B4ASnippetAudio/Video
Change Pitch of Wave File Playback using SoundPool
Change Pitch of Wave File Playback using SoundPool
@Danamo · 2017-12-29
B4ASnippetEditText/Textview/TextArea/TextField
Change EditText Colors
Change EditText Colors
@Erel · 2017-12-26
B4ASnippetPermissions
AddPermission - A list of permissions in Android
AddPermission - A list of permissions in Android
@DonManfred · 2017-12-21
B4ASnippetFirebase
Send notifications to one of two apps in the same project at firebase
Send notifications to one of two apps in the same project at firebase
@fabricio · 2017-12-13
B4ASnippetPane(l)
Get panel touch direction
simple code to get the slide direction on a panel. (Right, Left, Top, Down)
@Douglas Farias · 2017-12-09
B4ASnippetB4A
Minimize Android App
A simple minimize function that may suit some apps.
@Jmu5667 · 2017-11-28
B4ASnippetSocial
WhatsApp: Send preset Message to specific number
WhatsApp a few years ago had published APIs that allowed to send messages to a specific number. For some time, those methods no longer work and new methods appear on the official website. (see: https://faq.whatsapp.com/en/android/28000012) You can now open a conversation with a phone number but not preset the message. Or, in the opposite direction, determine which message but not specify who should receive it. Yet with Google+ (and all Browser) you can select the user and the message with the entry. So there is an official method and is not documented. Or these bees are paid for commercial use. The only documentation that is found and how to send a message set to a specific user across the Web. (https://faq.whatsapp.com/en/android/26000030/?category=5245251) By using this I created a small code that allows an App to send a specific message to a specific user. Anyway, you have to confirm by WhatsApp .... but it is already something ... I attach the code
@Star-Dust · 2017-11-25
B4ASnippetOther
IPInfo - B4A Library source code
- Get external IP, latitude and longitude, ISP, and more. - Country information based on IP. - Speed test.
@NJDude · 2017-11-19
B4ASnippetFirebase
Read only Keys of a Node in Firebase Database via REST API
Code to get just the keys (nodes, childnames, ...) of a Database path.
@fredo · 2017-11-19
B4ASnippetRandomise
Weighted Random
Say you are a game developer and you want to get a random weather condition where the probability of "sunny" is 50%, the probability of "rain" is 30% and the probability of "fog" is 20%.: WeightedRandom_GetValue("sunny:0.5, rain:0.3, fog:0.2")
@wonder · 2017-11-12
B4ASnippetViews - events
Swipe to Action
I tried many times to achieve a delete effect such as Gmail app without using a CustomListView, but without success. Without access, since today. This is the code, hoping that can help
@Emme Developer · 2017-11-08
B4ASnippetGPS/location/maps
Google Maps POI details
In Google maps there are more than 100 million businesses and points of interest that are updated frequently through owner-verified listings and user-moderated contributions. In order to get details of one of these, when an user click on it on maps, you need a key. After followed this tutorial, add this code
@Emme Developer · 2017-11-02
B4ASnippetWifi
Wifi dis/connection event
This code snippet checks when WIFI will be connect or disconnect. Note that this works only for wifi event, if you want any connection event you should use instead android.net.conn.CONNECTIVITY_CHANGE (in this case this code will not work).
@Emme Developer · 2017-11-01
B4ASnippetJSON
JSON - GetObjFromPath()
This code helps you navigate JSON trees like a boss!
@wonder · 2017-10-30
B4ASnippetDatabase
SQlite: Backup database and alter table
Here''s a little sub to backup and alter a table (assuming you have all the SQlite parts in the starter service). The sub checks if the column is already defined. Of course you can leave the loop at once with a return. For debug reasons I''ve used a Boolean here.
@KMatle · 2017-10-30
B4ASnippetPDF
PDF: Calculate chars per line/lines per page
PDF: Calculate chars per line/lines per page
@KMatle · 2017-10-29
B4ASnippetDialogs
Non-centered Custom layout dialog
This example uses JavaObject to change the CustomLayoutDialog position. It also demonstrates how to access the layout fields and how to make sure that the keyboard is closed when the dialog is dismissed.
@Erel · 2017-10-26
B4ASnippetDialogs
SD: MsgBox re-stylized
There are many libraries that update and modify MsgBox and all interesting, but no one meets my needs. So I created someone I did. I hope someone else might be useful. It''s not a library. Only snippets of code. Does not require any additional library. You can include on your sources or you can wrap them into Class.
@Star-Dust · 2017-10-23
B4ASnippetAnimation
Simple Halo Animation
Code to create a nice halo animation
@Erel · 2017-10-17
B4ASnippetStrings
isIn() - Python ''In''
isIn() - Find anything in anything!! :) Replicates the behavior of the Python keyword ''in'' which returns true if something is part of something else
@wonder · 2017-10-04
B4ASnippetB4A [A:B]
PyRange() - Python index operator [a:b]
Obtain any object or range of objects (or characters from a String), using square brackets, just like in Python.
@wonder · 2017-10-04
B4ASnippetMaths
Python Modulo
In Python, the modulo (%) of a negative number is calculated differently providing us a more useful result for real-life applications.
@wonder · 2017-10-04