PhoneEditText-Android
PhoneEditText makes it easy for you to handle country codes in Phone number fields of your android application. PhoneEditText identifies your country and sets its respective dial code automatically.
How to use?
Jitpack
Add JitPack to your Project level build.gradle file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the Phone Edit Text Dependency to App level build.gradel file
dependencies {
implementation 'com.google.android.material:material:1.1.0-alpha09'
implementation 'com.github.amannirala13:PhoneEditText-Android:1.1.1'
}
Jcenter
Add the dependency to App level build.gradel file
implementation 'com.google.android.material:material:1.1.0-alpha09'
implementation 'com.asdev.PhoneEditText-Android:PhoneEditText-Android:1.1.1'
Using in XML layout
<com.asdev.phoneedittext.PhoneEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
Get Dial code
import com.asdev.phoneedittext.PhoneEditText;
...
...
...
PhoneEditText myPhoneEditText = findViewById(R.id.YOUR_EDIT_TEXT_ID)
String code = myPhoneEditText.getDIAL_CODE();
/* return type of getDIAL_CODE() is String*/
Advantages
- No drop down lists.
- No user based inputs
- No predictive definitions of dial codes.
- Dial code can be changed upon the wish of the user
- Full support of TextInputEditText
Limitations
- Sets the country code to default +91 when the device is on a Wi-Fi network
Contributors ✨
Thanks goes to these wonderful people (emoji key):
Aman Nirala 💻 🎨 📖 🤔 |
This project follows the all-contributors specification. Contributions of any kind welcome!
License
❤ Connect and Support
We would love to connect with you on different social media platforms, here are the links to all out social-media and coding platform handles where you can follow our work.
If you like our work, a bit of contribution would motivate us a lot for more open source contributions.