B4A Library International Phone Input

IntlNumberInput is a custom view for Android that allows the user to enter his phone number in an elegant and friendly way. It adds a flag dropdown to any input, automatically detects the user's country, displays a relevant placeholder and auto formats the number as they type.
it wraps this project : https://github.com/Rimoto/IntlPhoneInput

IntlPhoneInput
Version:
1
  • IntlPhoneInput
    Events:
    • onkeyboarddone (isValid As Boolean)
    • onvaliditychange (isValid As Boolean)
    Fields:
    • ba As BA
    Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
    • BringToFront
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • hideKeyboard
      Hide keyboard from phoneEdit field
    • isValid As Boolean
      Check if number is valid
      Return type: @return:boolean
    • setDefault
      Set default value
      Will try to retrieve phone number from device
    Permissions:
    • android.permission.READ_PHONE_STATE
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • EmptyDefault As String [write only]
      Set default value with
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Number As String
      Get number
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int
Download it from here.Due to resourse load.
https://www.dropbox.com/sh/o9yar82awa2onjn/AAAa9GfMTnFuEXMcRJetak_Wa?dl=0
intlphoneinput-spinner.png
 

biometrics

Active Member
Licensed User
Longtime User
Any idea why I'm getting this error when running the example?

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 32 (Main)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
   at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
   at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
   at java.lang.reflect.Method.invoke(Native Method)
   at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
   at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
   at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
   at java.lang.reflect.Method.invoke(Native Method)
   at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
   at cm.jahs.intlphoneinput.main.afterFirstLayout(main.java:102)
   at cm.jahs.intlphoneinput.main.access$000(main.java:17)
   at cm.jahs.intlphoneinput.main$WaitForLayout.run(main.java:80)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:234)
   at android.app.ActivityThread.main(ActivityThread.java:5526)
   at java.lang.reflect.Method.invoke(Native Method)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.reflect.InvocationTargetException
   at java.lang.reflect.Method.invoke(Native Method)
   at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
   at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
   ... 17 more
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String net.rimoto.intlphoneinput.Country.getIso()' on a null object reference
   at net.rimoto.intlphoneinput.IntlPhoneInput.setNumber(IntlPhoneInput.java:209)
   at net.rimoto.intlphoneinput.IntlPhoneInput.setDefault(IntlPhoneInput.java:107)
   at net.rimoto.intlphoneinput.IntlPhoneInput.init(IntlPhoneInput.java:87)
   at net.rimoto.intlphoneinput.IntlPhoneInput.<init>(IntlPhoneInput.java:51)
   at cm.jahswant.intlphoneinput.IntlPhoneInputWrap._initialize(IntlPhoneInputWrap.java:41)
   ... 20 more
 

biometrics

Active Member
Licensed User
Longtime User
Make sure you include all resources as in download.

I downloaded the three files: B4AExample.zip, Library.zip and res.rar.

Unzipped Library.zip into C:\Program Files (x86)\Anywhere Software\Basic4android\Additional Libraries.

Extracted the folder B4AExample from B4AExample.zip.

Unzipped res.rar. into the B4AExample folder. If it's anywhere else I get an error that it's not found.

Capture.PNG
 

jahswant

Well-Known Member
Licensed User
Longtime User
Unzipped Library.zip into C:\Program Files (x86)\Anywhere Software\Basic4android\Additional Libraries.

Extracted the folder B4AExample from B4AExample.zip.

I'm not in my dev environment i'll test it as soon as possible. You should note that it's an old library(2015) compiled with B4A 5.20 not sure if with updates it got broken.
 
Top