HeartBeatView

Johan Schoeman

Expert
Licensed User
Longtime User
It is a wrap for this Github project

You need to enable AppCompat V3.20 in the libs tab of the B4A project.

Attached the B4A sample project, the B4A library files, and the Java code. You will need a recent version of android-support-v4.jar in your additional library folder as well as AppCompat V3.20 by @corwin42

You can drive this PULSING heart from data collected from a Bluetooth connected Heart Rate Monitor.

Seems that you need at least Lollipop to run this project.

Sample code:

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



#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.
    Dim t As Timer


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.

    Private hbv1 As HeartBeatView
    Private Label1 As Label
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")
    t.Initialize("t", 10000)

    hbv1.DurationBasedOnBPM = 72
    hbv1.ScaleFactor = 0.3

    Dim hbv As Int
    hbv = Rnd(30, 121)
    hbv1.DurationBasedOnBPM = hbv
    Label1.Text = hbv & " bpm"
   

End Sub

Sub Activity_Resume
   
    hbv1.start
    t.Enabled = True

End Sub

Sub Activity_Pause (UserClosed As Boolean)
   
    hbv1.stop
    t.Enabled = False

End Sub

Sub t_tick
   
    Dim hbv As Int
    hbv = Rnd(30, 121)
    hbv1.DurationBasedOnBPM = hbv
    Label1.Text = hbv & " bpm"
   
End Sub

1.png
 

Attachments

  • TheJavaCode.zip
    5.4 KB · Views: 200
  • HeartBeatViewLibFiles.zip
    7.9 KB · Views: 206
  • b4aHeartBeatView.zip
    8.8 KB · Views: 204

Johan Schoeman

Expert
Licensed User
Longtime User
There is no recent version of this file. It does not exists anymore.

The correct way is to use the maven-repositories.
At least with B4A 6+
I am using it with B4A v6+ and it is working. It all depends on how you update your SKD.
 

Mashiane

Expert
Licensed User
Longtime User
One of the things I like about your posts is that you have a video and at times images that show what your lib is doing and you don't need to download and compile to see what it does first, thus me enjoying your work much. This helps one choose what they need to use now, watch your post and can always revert back. Brilliant! And you still dont want to write that book about wrapping stuff.... wena!! :p
 
Top