B4A Library Bubble Level

If you ever have a need to access a Bubble Level from within your B4A project, then here is one that you can use.

Extract font.zip and then copy this folder into the /Files folder of your B4A project
Extract LevelRes.zip and then copy the folder and its contents to be on the same folder level as that of the /Files folder of the B4A project.

The app has a menu for calibration and to change settings (amongst others making a sound when the device is level)

Take note of the B4A manifest file.

1.png



2.png


3.png


4.png


5.png


Sample Code:
B4X:
#Region  Project Attributes
    #ApplicationLabel: b4aLevel
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#AdditionalRes: ..\LevelRes

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
   
   
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
   
    Dim bl As Level


    Private Button1 As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
   
    bl.Initialize("bl")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub Button1_Click
   
    bl.Start_Level
   
End Sub
 

Attachments

  • b4aLevel.zip
    7.9 KB · Views: 368
  • BubbleLevelLibFiles.zip
    30.1 KB · Views: 400
  • LevelRes.zip
    29.2 KB · Views: 387
  • TheJavaCode.zip
    20.6 KB · Views: 349
  • fonts.zip
    8.4 KB · Views: 370

Almora

Active Member
Licensed User
Longtime User
I have been using the library for 2 years. Error occurs when i update the app.
do you have any idea about the error?
thanks..

Linking resources Error
warn: removing resource com.app.xxx:string/preference_sensor without required default value.
c:\bubbleLevel\drawable\bubble_2d.xml:5: error: resource color/bubble_border (com.app.xxx:color/bubble_border) not found. ................................
 
Top