Tutorials & Examples

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

Android Text To Speech example

Android can synthesize and play text.
Using the TTS library you can easily add this feature to your application.

tts_1.png


B4X:
Sub Process_Globals...
 

Attachments

  • TTSExample.zip
    6.2 KB · Views: 31,241
  • TTS.apk
    69.8 KB · Views: 3,646

Mails from Anywhere software

Hi Erel,

Finally decided to buy the Android version.
After paying via Plimus I was waiting for your email to download the .exe file, etc.

Quite some hours later I noticed that there were...
 

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...
 

Android Network Tutorial

This is an old tutorial. All new implementations of network solutions should be based on AsyncStreams.

The Network library allows you to communicate over TCP/IP with other computers or...
 

Attachments

  • NetworkExample.zip
    23.7 KB · Views: 7,580
Last edited:

Android views animation tutorial

The Animation library allows you to animate views.
These small animations are really nice and can affect the user overall impression of your application.

The attached program demonstrates the...
 

Attachments

  • AnimationExample.zip
    10.6 KB · Views: 6,464
  • Animation.apk
    77.1 KB · Views: 2,774

Setting value for a text label

Hi,

Sorry for the silly question.

I have created a layout with a single label called jbox.
I simply want to set the text of the label in the program but cant seem to do it.

My code ...
 

Creating a table view based on ScrollView

A much improved version is available here.

You can use the code in this example to show data in tabular form.

table_1.png


The table is...
 

Attachments

  • TableExample.zip
    5.7 KB · Views: 6,562
  • TableExample1.1.zip
    12.2 KB · Views: 6,946

Android JSON tutorial

JSON format is a a format similar to XML but usually it is shorter and easier to parse.
Many web services now work with JSON. JSON official site: JSON

Using the new JSON library, you can...
 

Attachments

  • JSONExample.zip
    5.2 KB · Views: 5,960
Last edited:

Android Serial tutorial

Attachments

  • SerialExample.zip
    6.3 KB · Views: 10,560
Last edited:

Nice utity for wireless file transfers

SwiFTP Server
This utility allows you to transfer files or applications to a device that is not connected by cable to your computer.
You can find it by searching the Android market. When it...
 

Take pictures with the internal camera

It is recommend to use the new CameraEx class. It provides more functionality.
The new Camera library allows you to take pictures using the back facing camera.

The following steps are...
 

Attachments

  • CameraExample.zip
    5.7 KB · Views: 10,156

Running shell commands as SuperUser

if you want run any shell command as superuser(you must have rooted phone), try this:
B4X:
Dim Command, Runner As String
Dim StdOut, StdErr As StringBuilder
Dim Result As Int
Dim Ph As Phone...
 

XML Parsing with the XmlSax library

Attachments

  • XmlSax.zip
    10 KB · Views: 6,095
Last edited:

DDMS - Dalvik Debug Monitor

Here is a tip for exploring the folders on the emulator and also its mounted SD-card (if you have added one like I did). I couldn't find a file-explorer in the emulator.

You can use a program...
 
Last edited:

Signing your application before uploading to Google Play

The result of compiling your application is an APK file. This is a package file that contains the compiled source code and the assets files.
The APK file must be signed before installation...
 

Pong - a game

Hi,

I have attached a little game. It's the old Pong.
At this time I still have no Android device. (Christmas will be soon :sign0060:)

Could someone be so nice to test it on a device and...
 

Attachments

  • pong.zip
    46.6 KB · Views: 911

SQL tutorial

Update 2018:

New video tutorial:


The source code is available here...
 

Attachments

  • SQL.zip
    8.1 KB · Views: 11,881
Last edited:

Creating a linked list using Type keyword

The Type keyword is used to create your own types or structures. You can use such types to create simple structures that group some values.
However you can also use it to create more complex...
 

Attachments

  • LinkedList.zip
    4.9 KB · Views: 1,197

TabHost tutorial

Last edited:

Text files

Many applications require access to a persistent storage. The two most common storage types are files and databases.
We will cover text files in this tutorial.

The predefined Files object has...
 
Top