A simple library that displays a beautiful list of all the countries allowing the user to pick the country he wishes and provide details like country code, iso code name,currency and flag.
E/CountryCodePicker: Failure to get drawable id.
java.lang.NoSuchFieldException: flag_bl
at java.lang.Class.getField(Class.java:891)
at com.mukesh.countrypicker.adapters.CountryListAdapter.getResId(CountryListAdapter.java:30)
at com.mukesh.countrypicker.adapters.CountryListAdapter.getView(CountryListAdapter.java:76)
at android.widget.AbsListView.obtainView(AbsListView.java:2346)
at android.widget.ListView.makeAndAddView(ListView.java:1875)
at android.widget.ListView.fillDown(ListView.java:702)
at android.widget.ListView.fillGap(ListView.java:666)
at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5029)
at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:4577)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:603)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
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)
I want to use this library but only problem is your Search EditText is not single line. Can you look forward on this issue asap and set SingleLine property to true ?
java.lang.NoSuchFieldError: No static field row_title of type I in class Lcom/mukesh/countrypicker/R$id; or its superclasses (declaration of 'com.mukesh.countrypicker.R$id' appears in /data/app/in.ticketninja.test-gy1ogBf0PImNXdeOb5B9_A==/base.apk)
at com.mukesh.countrypicker.CountryListAdapter$Cell.from(CountryListAdapter.java:70)
at com.mukesh.countrypicker.CountryListAdapter.getView(CountryListAdapter.java:51)
at android.widget.AbsListView.obtainView(AbsListView.java:2372)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1408)
at android.widget.ListView.onMeasure(ListView.java:1315)
at android.view.View.measure(View.java:21998)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
at android.view.View.measure(View.java:21998)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:21998)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:21998)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:721)
at android.view.View.measure(View.java:21998)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2410)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1471)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1751)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1386)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6733)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
private Country afghanistan() {
Country country = new Country();
country.setCode("AF");
country.setName("Afghanistan");
country.setDialCode("+93");
country.setFlag(R.drawable.flag_af);
return country;
}
I came across your fantastic project and i wanted to help contribute to your project by using my Skills in Logo Design to contribute and help create a logo for your project...
I am already working on an idea... i will update what i have done here so you can give your feedback and possibly any change or tweek you may want...
Below are the steps I followed in my Xamarin Android project.
I have added the nuget package "Karamunting.Android.MukeshSolanki.CountryPickerAndroid" version="1.1.9" in my project.
Now I just want to display the country code picker dialog so I followed the following Csharp code
CountryPicker countryPicker = new CountryPicker();
countryPicker.Show(this.Activity.SupportFragmentManager, "COUNTRY_PICKER");
countryPicker.CountrySelect += (o, e) => {
// Perform action on click
};
How is it supposed to create my own Country (as described in README, to set custom list of countries, load country flag by iso, etc), if all constructors of Country class are package-access ?!
We need to open them and make convenient to use. We need Country.Builder() with setters and default value. Say, i need to show picker for provinces - i'd like to use CountryPicker, but with my own custom list of "countries" (provinces) without flags - just with names and some province codes. I'm not able to do that atm.
Hello Mukesh,
I am developing an android app in which I want to integrate "Country Selector", I find your library truly amazing, but I am unable to change the color of it's search edittext.
When using your library I found myself needing to save the country flag selection in a database. I want to do this as country code or country name. Then when re-loading the view, I need to set the flag from the database (it is possible for the user to change the country from another platform). For this, I am proposing two public static methods.
The EditText for search is multiline (it just shows one line at a time). This can be fixed by adding: android:inputType="text" to the country_code_picker_search EditText
I am using exactly the same code in the example.
The dialog shows properly, but when clicking a country for selection the dialog doesn't close and the event: "onSelectCountry" is not fired.
One country behind the keyboard. Tested with Gboard and Samsung Keyboard. This is very annoying if you only have one result on screen, as it covers the only result
Hi, thanks for the library. I want to change the background color from Black, which I'm currently getting to white which is there in the library image currently. How to do that?
I'm trying to get country name in onCreate( ) method of activity and using getCountryFromSIM( ) method of CountryPicker to get the current country name of the user but its not resolving this method and showing "Cannot resolve method 'getCountryFromSIM(this)' .
is necessary can add more items to the list, for example i need add an item where this one is ALL COUNTRIES so when the user select this item i know he wants to filter all countries
because i am creating a filter with this library
this would be like your method setCountriesList() but instead put setCountry()
could you please add that ? :)
It's a minor issue, but users can press return on their soft keyboard to enter a carriage return, which then empties the results list. This could be solved pretty trivially with android:inputType="textShortMessage".
I followed all the steps but I'm getting this error
java.lang.NoSuchFieldError: No field country_flag of type I in class Lcom/mukesh/countrypicker/R$id; or its superclasses (declaration of 'com.mukesh.countrypicker.R$id' appears in /data/app/com.package.app/base.apk)
java.lang.NoSuchFieldError: No static field country_flag of type I in class Lcom/mukesh/countrypicker/R$id; or its superclasses (declaration of 'com.mukesh.countrypicker.R$id' appears in /data/app/com.imarad.app-2/base.apk) at com.mukesh.countrypicker.CountriesAdapter$ViewHolder.<init>(CountriesAdapter.java:67) at com.mukesh.countrypicker.CountriesAdapter.onCreateViewHolder(CountriesAdapter.java:36) at com.mukesh.countrypicker.CountriesAdapter.onCreateViewHolder(CountriesAdapter.java:14) at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6519) at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5706) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5589) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5585) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2231) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1558) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1518) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:610) at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3719) at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3135) at android.view.View.measure(View.java) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java) at android.widget.LinearLayout.measureVertical(LinearLayout.java) at android.widget.LinearLayout.onMeasure(LinearLayout.java) at android.view.View.measure(View.java) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java) at android.widget.FrameLayout.onMeasure(FrameLayout.java) at android.view.View.measure(View.java) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java) at android.widget.FrameLayout.onMeasure(FrameLayout.java) at android.view.View.measure(View.java) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java) at android.widget.LinearLayout.measureVertical(LinearLayout.java) at android.widget.LinearLayout.onMeasure(LinearLayout.java) at android.view.View.measure(View.java) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java) at android.widget.FrameLayout.onMeasure(FrameLayout.java) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java) at android.view.View.measure(View.java) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java) at android.view.Choreographer$CallbackRecord.run(Choreographer.java) at android.view.Choreographer.doCallbacks(Choreographer.java) at android.view.Choreographer.doFrame(Choreographer.java) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java) at android.os.Handler.handleCallback(Handler.java) at android.os.Handler.dispatchMessage(Handler.java) at android.os.Looper.loop(Looper.java) at android.app.ActivityThread.main(ActivityThread.java) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
I am using Version 1.2.2 of the library.
Basically, I am doing an onClick on the EditText but I persistently get this error
unable to use properly library with users from Ukraine, 'cos by Google standards Ukraine is shortened to uk (when we are extracting country from Locale) and NOT ua
FATAL EXCEPTION: main
java.lang.IllegalStateException: Fragment already added: CountryPicker{5321ceb8 #0 COUNTRY_PICKER}
at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1679)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:727)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149)
at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2013)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
recently with the last update (2.0.1) i got this error
error: cannot find symbol class OnCountryPickerListener
.............................................................................................................
with problems with my internet i attached 2 same issues so i closed one