Tutorials & Examples

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

[video] Common mistakes

A video demonstrating several common programming mistakes:


 
Last edited:

Flip 3D View

I came across the attached project here and thought it is quite nifty. It is a post by a B4A member (@Lyndon Bermoy )

Have added an additional imageview to animate a second image...
 

Attachments

  • Flip3DView.zip
    138.7 KB · Views: 1,153

Cryptography - MD5 & SHA-1 (inline java code)

It only prints to the log. Change the "message" in Sub Activity_Create
 

Attachments

  • Cryptography_MD5_and_SHA1.zip
    12.4 KB · Views: 1,344

imageManipulation (with inline java code)

imageManipulation.png


Done just for fun...work through the java code and you can create various derivatives for yourself by changing some of the code in some of the methods - eg add code to pass...
 

Attachments

  • imageManipulation.zip
    132.9 KB · Views: 975
Last edited:

SMS Incoming & Reply Separation

Good Day!

I've test this code to retrieve sms message, from my samsung, and it works.

' ------------------------------------------------------
Sub Process_Globals
Dim sms_idkey As Long...
 

SQLite, remote connection

Hello.
I have the following problem: I can not find an example of code written to run a remote connection to a SQLite DB.
I used the DRC to connect to a DB MS-SQL.
I do not understand if the DRC...
 

Arduino ADK Coda

Introduction

This final tutorial has some explanatory comments about the two programs running on the Arduino and the Android device. Those programs should be largely self-explanatory as...
 
Last edited:

Multiple layout

I am trying to use the examples relating to layout or multiple panels . But all the files give me error "The value cannot be null" "parameter name: input Error File twolayouts1.bal: "I have read...
 

Library (JAR) interface using inline Java code and "direct calling"

Attached project demonstrates two ways to interface with a JAR file:

1. Using the JavaObject run method "directly"
2. Making use of inline Java code

For method 1 you need to make use of...
 

Attachments

  • JHS_JO_IJC.zip
    70.9 KB · Views: 810

[Wish] Code folding

It would be very handy if we could fold up our code on If Then statements.

Thanks...
 

Graphical Life Cycle of a B4A Activity

Hi all...

I'm posting this in the hopes that it'll help anyone programming with B4A to understand the life cycle of an activity. I struggled with this a bit, and the graphical representation...
 
Last edited:

Local High Score Leaderboard

Attachments

  • LocalHighScores.zip
    8.2 KB · Views: 525
Last edited:

Image - Various ways of Image Manipulation

Examples of image processing

Click on any one of the displayed images to change to an alternate image.

Made use of Jpeg library by @agraham

See...
 

Attachments

  • JHS_IMAGE_SWAP_ARGB_V1.zip
    466.2 KB · Views: 563
  • JHS_IMAGE_COLOR_BALANCE_V1.zip
    481.7 KB · Views: 529
  • JHS_IMAGE_CONTRAST_V1.zip
    466 KB · Views: 515
  • JHS_IMAGE_BITWISE_BLEND.zip
    149.2 KB · Views: 489
  • JHS_DITHERING_V4.zip
    41.5 KB · Views: 458
  • JHS_IMAGE_COLOR_SHADING.zip
    23 KB · Views: 511
  • JHS_IMAGE_COLOR_TINT.zip
    454.3 KB · Views: 524
  • JHS_IMAGE_CONVOLUTION.zip
    445.2 KB · Views: 511
  • JHS_IMAGE_DISTORT_BLUR_V1.zip
    429.2 KB · Views: 504
  • JHS_IMAGE_ERODE_DILATE.zip
    73.9 KB · Views: 499
Last edited:

Device Sensors

The attached project (with inline Java code) will list all the sensors on your device in the project's log.
 

Attachments

  • deviceSensors.zip
    11.2 KB · Views: 772

Sudoku generator and solver

The attached project will generate and solve Sudoku puzzles (9x9). The code to solve the puzzles with was adapted from here (converted to B4A). The code to generate Sudoku puzzles with comes...
 

Attachments

  • src.zip
    4.1 KB · Views: 1,029
  • JHS_Sudoku.zip
    167.3 KB · Views: 1,033

Different examples with 2 layouts

As an answer to the thread Forms alike, I thought that the examples below would be of general interest.

Attached there are 4 examples with two same layouts but with different managements...
 

Attachments

  • TwoLayoutActivities.zip
    14.1 KB · Views: 2,173
  • TwoPanelActivity.zip
    12.4 KB · Views: 1,811
  • TwoPanelLayouts.zip
    14.5 KB · Views: 1,906
  • TwoActivityLayouts.zip
    8.7 KB · Views: 1,524
Last edited:

Nine patch images tutorial

Android supports a special format of PNG images that can be resized by replicating specific parts of the image.
This images also include padding information.
These images are named nine-patch...
 

Attachments

  • NinePatchExample.zip
    7.4 KB · Views: 2,677

Tip: Distributing your app on iis web server

After hours of research i was able to create a download link for my app on a windows server. here are the instructions for doing so.

under iis create a mime type by right clicking on your...
 
Last edited:

MidiSystem Recording example

This example loads a midi file and records an extra track from either the on board keyboard, or an external USB midi device.

Please be careful when saving files as the recorded track will be...
 

Attachments

  • Piano&FullMidiLib.zip
    19.4 KB · Views: 675
Last edited:

MidiSystem Drum sequencer

This example allows creation of loops on multiple tracks as they are played. Just like a drum sequencer. It demonstrates creating a midi sequence and tracks, and adding events and messages...
 

Attachments

  • DrumSequencer.zip
    30.5 KB · Views: 633
Top