B4ASnippetUpdater
Receive package update
Code to start the app automatically if it was updated
@fredo · 2018-04-12
B4ASnippetService/Receiver
Example of #Extends in Service
Starting from B4A v6.50 services support the #Extends attribute. This is useful for libraries that need to extend a service. The previous solution was to communicate with a B4A service with a specific name. This was more cumbersome and limited. The #Extends attribute allows the B4A service to directly extend the library service.
@Erel · 2018-03-13
B4ASnippetKeyboard
Show/Hide keyboard without IME
Show/hide keyboard without use of IME
@npsonic · 2018-03-13
B4ASnippetImages
Image Viewer
Image Viewer
@Indy · 2018-03-12
B4ASnippetTheme
Version safe themes
Update: If you are using B4A v8.0+ then you should just add: CreateResourceFromFile(Macro, Themes.DarkTheme) ''or Themes.LightTheme Older versions: If you are not explicitly setting the theme in the manifest editor then it will change based on the device version and targetSdkVersion value. Assuming that targetSdkVersion is set to 26 (as soon required by Google) then the theme used by default will be: Device version Android 2.x - Always the old Android 2.x theme Android 4.x - Theme.Holo (dark background) Android 5.x - 6.x - Theme.Material (dark background) Android 7.x+ - Theme.Material.Light.DarkActionBar (light background) This behavior can be problematic. In most cases it is better to explicitly set the theme. The correct way to set it is with manifest code
@Erel · 2018-03-12
B4ASnippetStrings
Password generator Sub
I needed to generate passwords in my app, so I wrote the code below, but calling the sub with strings, like "(6, "NUMBERS")", or "(8, "NUMBERS_UPPERCASE_SYMBOLS")". When I was going to share the code here as a snippet I saw this thread, and then I took the idea of calling the sub with arguments (True, True, False, False), instead of using a string. So, although the library exists, perhaps someone prefers or finds easier to use a Sub, or wants to customize the characters to use (to avoid similar characters, like "I1", "O0", for example).
@Ivan Aldaz · 2018-03-11
B4ASnippetCharSequence / CSBuilder
Strikethrough with CSBuilder
Strikethrough with CSBuilder
@fredo · 2018-03-11
B4ASnippetCharSequence / CSBuilder
CSBuilder with leading margin
CSBuilder with leading margin
@Erel · 2018-03-09
B4ASnippetNotifications [NOTIFICATION BUILDER]
How to add a custom sound from File.DirAssets [Notification Builder]
I want to share with you my solution, using the Notification Builder (Thanks to @barx for this awesome library <3 ), to play a custom sound from your DirAssets folder. I did it because this method use the notification volume for this sound (instead of the Soundpool solution, that use the media volume).
@Carlos Huerta · 2018-02-23
B4ASnippetColour
Scrollbar Color
This code uses reflection to change the ScrollView scroll bar color
@Erel · 2018-02-21
B4ASnippetB4A
Set Status bar colors
A useful sub to set status bar color and foreground color, at runtime
@Emme Developer · 2018-02-19
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