Android Question New to OOP

Julian Griffin

New Member
Hi, I am not new to programming but I have never real got to grips with Object Oriented Programming. I understand the concept. When it comes to objects I can visualise like buttons, I can create a class add methods and properties and instance it into buttons on the screen. My confusion comes when I start needing things from a library. I learnt procedural Basic many years ago; but every time I try to use OOP I come unstuck very quickly, and end up in a corner, curled up, rocking back and forth, sucking my thumb, and gently whimpering. The is the effect VB, C#, and Java Script has on me.

For instance, If I what to use a specific Font in a Label object, or play a very short .wav file (less than 1 second). I get lost in a plethora of libraries. My hope is that B4A will offer ways to access system objects with less of a steep learning curve needed for other language like C#, Java, Java Script.

So to my question. Can anyone direct me to the documentation for playing very short .wav files, and how to install a font and then set a Label attribute to that font.

Any help anyone can give with “Rapid Prototyping” with B4A would be much appreciated. Thank you.

Regards Julian.
 

eurojam

Well-Known Member
Licensed User
Longtime User
this is a small example playing a short soundfile without any libs:
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
  Dim MPlayer As MediaPlayer
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("Layout1")
   MPlayer.Initialize 'Make an instance of the player
   MPlayer.Load(File.DirAssets, "beep.mp3") 'Load from File folder beep.mp3
   MPlayer.Play 'play one beep
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…