Android Input Dialog Tutorial using Basic4Android

Today, I will make a tutorial for the different kinds of dialog. First, I will make a tutorial for input dialog. The first thing that you will do is to add "Dialogs" in the library of Basic4Android Software. Next, create a designer, put a button in it and named Button1, and lastly saved it and named the layout name "main". Next, Copy this code below:
  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.  
  5. End Sub
  6.  
  7. Sub Globals
  8.         'These global variables will be redeclared each time the activity is created.
  9.         'These variables can only be accessed from this module.
  10.  
  11.         Dim Button1 As Button
  12.         Dim bmp As Bitmap
  13. End Sub
  14.  
  15. Sub Activity_Create(FirstTime As Boolean)
  16.        
  17.         Activity.LoadLayout("Main")
  18.         bmp.InitializeSample(File.DirAssets, "bermoy.jpg",48,48)
  19.        
  20. End Sub
  21.  
  22. Sub Activity_Resume
  23.  
  24. End Sub
  25.  
  26. Sub Activity_Pause (UserClosed As Boolean)
  27.  
  28. End Sub
  29.  
  30. Sub Button1_Click
  31.         Dim Id As InputDialog
  32.         'Id.PasswordMode = True
  33.         Id.InputType = Id.INPUT_TYPE_DECIMAL_NUMBERS
  34.         'Id.InputType = Id.INPUT_TYPE_NUMBERS
  35.         'Id.InputType = Id.INPUT_TYPE_PHONE
  36.         Id.Input = ""
  37.         Id.Hint = "Enter some text!"
  38.         Id.HintColor = Colors.ARGB(196, 255, 140, 0)
  39.         ret = DialogResponse.CANCEL
  40.         ret = Id.Show("Input the required text", "B4A Input Dialog", "Yes", "No", "Maybe", bmp)
  41. End Sub
Note: Id - is our variable name for our InputDialog. PasswordMode - the method name for putting a password text in the inputbox. InputType - refers to the inputting type either text, number, phone, decimal, etc. Hint - refers to the hint inside the our InputDialog Text. HintColor - refers to our RGB color in the Hint. ret - our variable used for Return. 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