Android Number Dialog Tutorial using Basic4Android
Submitted by donbermoy on Thursday, January 23, 2014 - 15:57.
Hi! Another tutorial for working with Dialogs is this what we called Number Dialog. This Dialog only refers to inputting of numbers either decimal, integer, or any numbers
First, you need to create one button and named it Button1. Next, named your layout name as "Main".
Declare first your variable in the Sub_Global like this:
I have initialized bmp as Bitmap because I wanted to have an icon to my Color HSV Dialog.
Here's the full code for this tutorial:
Note:
nd - our variable used for initiating NumberDialog.
nd.Digits = 10 - the number of digits that we initialized is at 10 digits.
nd.Decimal = 2 - a syntax used in the declaring the number of decimal places, but we initialized it in two decimal places.
nd.ShowSign = True - a syntax used in declaring and showing the sign of the numbers either positive or negative.
ret - our variable in object that is used for the input dialog in color.
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
- Sub Globals
- 'These global variables will be redeclared each time the activity is created.
- 'These variables can only be accessed from this module.
- Dim Button1 As Button
- Dim bmp As Bitmap
- End Sub
- 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 Button1 As Button
- Dim bmp As Bitmap
- 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")
- Activity.LoadLayout("Main")
- bmp.InitializeSample(File.DirAssets, "bermoy.jpg",48,48)
- Activity.Title = "Number Dialog - Lyndon Bermoy"
- End Sub
- Sub Activity_Resume
- End Sub
- Sub Activity_Pause (UserClosed As Boolean)
- End Sub
- Sub Button1_Click
- Dim nd As NumberDialog
- nd.Digits = 10
- nd.Number = -12345
- nd.Decimal = 2
- nd.ShowSign = True
- ret = nd.Show("B4A Number Dialog", "Yes", "No", "Maybe", bmp)
- ToastMessageShow(ret & " : " & nd.Number, False)
- End Sub
Comments
Add new comment
- Add new comment
- 77 views