Tutorials & Examples

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

How to get track change data

ie: If you want to make a music control widget

First you need to add a broadcast listener to the manifest

AddReceiverText(thenameofyourservice,
<intent-filter>
<action...
 

Otsu Thresholding - binarization of images

This project demonstrates grayscaling of a multi colored image and then the binarization (i.e black or white pixels only) of the grayscaled image. The binarization is based on Otsu Thresholding as...
 

Attachments

  • JHS_OTSU_V2.zip
    61.2 KB · Views: 1,111
Last edited:

Image - Dithering 8 bit Grayscale images

This project demonstrates dithering of 8 bit grayscale images as explained at www.fiji.sc/Dithering. Methods included are the following:

Floyd-Steinberg
Atkinson
Jarvis-Judice-Ninke
Stucki...
 

Attachments

  • JHS_DITHERING_V4.zip
    41.5 KB · Views: 920
Last edited:

Image - 17 different ways of Converting RGB Images to Grayscale

This project demonstrates the conversion of RGB images to various options of Grayscale images. It is based on the tutorial at http://www.tannerhelland.com/3643/

Click on any one of the...
 

Attachments

  • JHSGRAYSCALE_V2.zip
    455.9 KB · Views: 1,427
Last edited:

Image - Enhancing Image Contrast by means of Histogram Equalization and Histogram Stretching

HISTOGRAM.png


This project demonstrates contrast enhancement of low contrast Grayscale images based on Histogram Equalization as explained at...
 

Attachments

  • JHS_HIST_EQUAL_V2.zip
    482.8 KB · Views: 1,238
  • JHS_HIST_STRETCH.zip
    482.6 KB · Views: 1,123
Last edited:

App to log GPS information, display map and send by eMail

Hello,
This app is a sample to get GPS info, save into file, load list of tracks, show in map,
assign a photo and send map and log info in CSV format by email.
Also there is some code about saving...
 

Attachments

  • GPSlogSample .zip
    249 KB · Views: 2,001

Lets play with vertical lables!

We'll do this using the Canvas object.

I'm just learning but pretending that I can teach it :)

Download the provided CanvasTest.zip and open it.

What I've done here is to create a panel and...
 

Attachments

  • CanvasTest.zip
    7.5 KB · Views: 726

Samsung Galaxy Nexus layout

I have a new toy :)

The attached AbstractLayout.txt file includes the layouts of the Samsung Galaxy Nexus, the first Android 4.0 device.
You should copy it to Basic4android installation folder...
 

Attachments

  • AbstractLayouts.txt
    773 bytes · Views: 1,016

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,157
  • Screenshot_2014-05-19-22-05.png
    Screenshot_2014-05-19-22-05.png
    164.8 KB · Views: 1,121
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: 1,020
  • USBMidiTest3-B4a3.2.zip
    13.5 KB · Views: 922
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: 952
  • ReedSolomonGeneratorPolynomialV2.zip
    8.6 KB · Views: 846
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: 891
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...
 
Top