B4A Library [B4X] [XUI] AS CountryPicker

A phone number prefix, flag emoji, country code picker.

I spend a lot of time in creating views, like this and to create a high quality view cost a lot of time. If you want to support me and further views, then you can do it here by Paypal.

You need:


Datasource from:
AS_CountryPicker
Author: Alexander Stolte
Version: 1.00

  • AS_CountryPicker
    • Events:
      • ItemClick (Item As AS_CountryPicker_Item)
    • Fields:
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • Base_Resize (Width As Double, Height As Double) As String
      • Class_Globals As String
      • CreateAS_CountryPicker_Item (FlagEmoji As String, CountryCode As String, DialCode As String, Name As String) As AS_CountryPicker_Item
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
        Base type must be Object
      • FillList As String
      • GetCountry As String
      • getCustomListView As b4a.example3.customlistview
      • getHeaderColor As Int
      • getHeaderLabel As B4XView
      • getHeaderSeperator As B4XView
      • getHeaderTextColor As Int
      • GetItem (CountryCode As String) As AS_CountryPicker_Item
        Gets an item with the country code
        Example: "de" to select Germany
      • GetItem2 (DialCode As String) As AS_CountryPicker_Item
        Gets an item with the dial code
        Example: "+49" to select Germany
      • getItemClickColor As Int
      • getItemColor As Int
        Call FillList if you change something
      • getItemTextColor As Int
      • getOwnCountryColor As Int
        Call FillList if you change something
      • getOwnCountryTextColor As Int
        Call FillList if you change something
      • getSearchTextField As com.stoltex.CountryPicker.as_textfieldadvanced
      • getSeperatorColor As Int
        Call FillList if you want to change the seperator in the list too
      • getTextFieldColor As Int
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • setHeaderColor (Color As Int) As String
      • setHeaderTextColor (Color As Int) As String
      • setItemClickColor (Color As Int) As String
      • setItemColor (Color As Int) As String
      • setItemTextColor (Color As Int) As String
        Call FillList if you change something
      • setOwnCountryColor (Color As Int) As String
      • setOwnCountryTextColor (Color As Int) As String
      • setSeperatorColor (Color As Int) As String
      • setTextFieldColor (Color As Int) As String
    • Properties:
      • CustomListView As b4a.example3.customlistview [read only]
      • HeaderColor As Int
      • HeaderLabel As B4XView [read only]
      • HeaderSeperator As B4XView [read only]
      • HeaderTextColor As Int
      • ItemClickColor As Int
      • ItemColor As Int
        Call FillList if you change something
      • ItemTextColor As Int
        Call FillList if you change something
      • OwnCountryColor As Int
        Call FillList if you change something
      • OwnCountryTextColor As Int
        Call FillList if you change something
      • SearchTextField As com.stoltex.CountryPicker.as_textfieldadvanced [read only]
      • SeperatorColor As Int
        Call FillList if you want to change the seperator in the list too
      • TextFieldColor As Int
  • AS_CountryPicker_Item
    • Fields:
      • CountryCode As String
      • DialCode As String
      • FlagEmoji As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Name As String
    • Functions:
      • Initialize
        Initializes the fields to their default value.
Changelog
  • 1.00
    • Release
  • 1.01
    • BugFixes
  • 1.02
    • Add get and set MyCountryCode
Have Fun
 

Attachments

  • AS CountryPicker Example.zip
    181.8 KB · Views: 219
  • AS_CountryPicker.b4xlib
    13.7 KB · Views: 193
Last edited:

Cristian Achim

Member
Licensed User
Longtime User
Hi!
Is there any chance to translate the title (Select country) and hint text (Search) from code?
Thank you!
 

Attachments

  • Untitled.png
    4.3 KB · Views: 127

Alexander Stolte

Expert
Licensed User
Longtime User
Is there any chance to translate the title (Select country) and hint text (Search) from code?
B4X:
AS_CountryPicker1.HeaderLabel.Text = "Test"

AS_CountryPicker1.SearchTextField.Hint.Text = "Hint Text"
AS_CountryPicker1.SearchTextField.Refresh
 

Cristian Achim

Member
Licensed User
Longtime User
Hi!
I have one more question, please. Is there any possibility to change own country (default selection)?
Thank you!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…