Tutorials & Examples

Android development starts here. Please do not post questions in this sub-forum.

Graphics ListView with 2 images, two labels and populated from a text file.

I wanted to provide this simple code for beginners like me.
The code is derived from the one written by the my teacher Klaus here.

This ListView is made with a ScrollView inside of which is...
 

Attachments

  • list viewex.zip
    109.6 KB · Views: 1,016
  • Screenshot_2014-05-19-22-05.png
    164.8 KB · Views: 986
Last edited:

Drawing a selection window

The following code draws a "selection" window when you move the finger:
B4X:
Sub Globals
    Dim Canvas1 As Canvas
    Dim Rect1 As Rect
    Dim sx, sy As Int
End Sub

Sub Activity_Create(FirstTime...
 

Getting the Contrast Color (for a label, etc)

There are situations where we change the panel colors, like when the user select its own color, and we dont know if the text of the labels will be seen. Commonly we define black or white for text...
 
Last edited:

PC-ANSI encoding on B4A ...

Hi,

normaly B4A use UTF8 encoding, but can create files in ANSI too, but be carefull !
Windows an a Western PC use ANSI codepage 1252, this is in B4A "WINDOWS-1252".
Mostly the encoding...
 

Midi USB device manager

The attached project shows the use of the USB library to communicate with Midi Devices over USB. I realize that this may open a can of worms, as it seems nothing about Midi communication is...
 

Attachments

  • USBMidiTest3.zip
    13.7 KB · Views: 840
  • USBMidiTest3-B4a3.2.zip
    13.5 KB · Views: 741
Last edited:

QR Code - how to construct a generator polynomial

The attached project will generate the Reed Solomon generator polynomials for 7, 10, 13, 15, 16, 17, 18, 20, 22, 24, 26, 28, and 30 error correction words that might be required for QR codes as...
 

Attachments

  • ReedSolomonGeneratorPolynomialV1.zip
    163.9 KB · Views: 807
  • ReedSolomonGeneratorPolynomialV2.zip
    8.6 KB · Views: 708
Last edited:

Tick Tock Test Timers Class

Works fine but the timer keeps cutting off in my rather big and complex app.... oh well I'll have to figure that out then.

Still perhaps useful to some.

You send it a number of milliseconds like...
 

Attachments

  • TickTockTest.zip
    8.3 KB · Views: 731
Last edited:

B4a projects source code.

Hi everyone,

For the last 10 hours, I browsed every threads in "Share your creations" because I wanted to gather a lot of source code. About 1/6 of the posts actually have source code shared...
 
Last edited:

LayoutView: The alternative way to load and use your layouts

Introduction

Following the moto design-more-code-less in our encapsulated b4a development speed-wagon, I created a LayoutView class that is also the core of the...
 
Last edited:

Hello world - Installing Android Emulator

XtraViews: DialogView Tutorial (quick and dirty)

[Arguably] Better Ninepatch

Hi guys. I write here hoping to help a few people.

Recently I started a project that makes heavy use of user personalization. I had bad experiences with nine patches in the past, even though I...
 

Instead of Label, consider a HorizontalScrollView

Hello,


I'm here to convince you to use HorizontalScrollViews instead of labels in your interfaces.


Labels get messy when you need them to display a string of indeterminate length within a...
 
Last edited:

MultiTrigger Soundpool Example

As a response to a forum question a few months ago, I posted an example of using the Gesture Library and Soundpool to create a musical instrument interface. The example is simple an has only two...
 

Attachments

  • MultiTriggerSoundTouchExample.zip
    28.2 KB · Views: 1,414
Last edited:

SQLite Database Pragmas

Pragmas: table_info, index_list, index_info, foreign_key_list

The full list of pragmas can be found at: http://www.sqlite.org/pragma.html. Note, the [match] field of the [foreign_key_list] pragma always shows...
 

Attachments

  • DBPragmas.zip
    323.1 KB · Views: 1,011
Last edited:

How I update my apps

I have a very specialized POS application running on Android devices that would not qualify to be entered into the Play Store. These apps need to be updated whenever there are new features or bug...
 

Downloading files using Service module

It is recommended to use HttpUtils2 instead of this code module. HttpUtils2 is more powerful and is easier to work with.

As discussed in the Services tutorial, some tasks are...
 

Attachments

  • DownloadService.zip
    6.9 KB · Views: 6,624

Retrieve HTML content from WebView using WebViewExtras library

Hello,
The code example below retrieves HTML content from WebView via three different techniques: 1.) MenuItem 2.) LongClick 3.) PageFinished. The code calls addJavascriptInterface() &...
 

Youtube master&slave

Hi,
I have assembled a few examples and I added the code to have a system to control via Bluetooth remote viewing of clips from youtube with two smartphones. A "slave" to be connected with a hdmi...
 

Attachments

  • Master.zip
    11.4 KB · Views: 431
  • Slave.zip
    10 KB · Views: 438
Last edited:

Create dynamic jpg using b4a and php

With this samplecode i will demonstrate to create a dynamic jpg from other image, put text´s on it, copy another image to it...

ATTENTION: This b4a-example uses CreateMap so you need B4A...
 

Attachments

  • Createjpgwithphp.zip
    9.2 KB · Views: 749
  • createimage.php_1.1.zip
    2.4 KB · Views: 727
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…