Android Phone Call Tutorial using Basic4Android

In this tutorial, i will introduce another kind of application in which it can dial the number you wanted to call. I call this Phone Call Application. P.S This project is developed in Basic4Android 2.47, and tested with Android 4.0.1. On this, you need to create one button and named it as "Call". Next, named your abstract design as "main". Your abstract designer will be like this one below: designer Declare your variable in the Sub_Global like this:
  1.        
  2. Sub Globals
  3.         'These global variables will be redeclared each time the activity is created.
  4.         'These variables can only be accessed from this module.
  5.        Dim ph As ICOSPhone
  6.         Dim Call As Button
  7. End Sub
Dim ph As ICOSPhone - ph here is our variable for ICOSPhone in which it has all the necessary libraries in using phone utilities. Dim Call As Button - we use a button to make a call from the phone. Now create a new activity. It should look like this:
  1. Sub Activity_Create(FirstTime As Boolean)
  2.         'Do not forget to load the layout file created with the visual designer. For example:
  3.         Activity.LoadLayout("main")
  4. End Sub
Now your activity when run will look like this: Activate Next, type the following code below. That code means to call a phone number when our Button Call will click.
  1. Sub Call_Click
  2.         ph.MakeCall(LoadBitmap(File.DirAssets,"call.png"))
  3. End Sub
When clicking this button it will have this image: image2 The MakeCall here is the method used to dial a number and then call. LoadBitmap(File.DirAssets,"call.png") this syntax refers to adding of image in the phone call. Here's the full code of this tutorial:
  1. Sub Process_Globals
  2.         'These global variables will be declared once when the application starts.
  3.         'These variables can be accessed from all modules.
  4. End Sub
  5.  
  6. Sub Globals
  7.         'These global variables will be redeclared each time the activity is created.
  8.         'These variables can only be accessed from this module.
  9.    Dim ph As ICOSPhone
  10.         Dim Call As Button
  11. End Sub
  12.  
  13. Sub Activity_Create(FirstTime As Boolean)
  14.         'Do not forget to load the layout file created with the visual designer. For example:
  15.         Activity.LoadLayout("main")
  16. End Sub
  17. Sub Activity_Resume
  18. End Sub
  19.  
  20. Sub Activity_Pause (UserClosed As Boolean)
  21.  
  22. End Sub
  23.  
  24. Sub Call_Click
  25.         ph.MakeCall(LoadBitmap(File.DirAssets,"call.png"))
  26. End Sub
When dialing the number and click the button call. This will display this image: calling For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below. Best Regards, Engr. Lyndon Bermoy IT Instructor/System Developer/Android Developer/Freelance Programmer Mobile: 09488225971 Landline: 826-9296 E-mail:[email protected] Add and Follow me on Facebook: https://www.facebook.com/donzzsky Visit and like my page on Facebook at: https://www.facebook.com/BermzISware

Add new comment