CountryCodePickerProject icon indicating copy to clipboard operation
CountryCodePickerProject copied to clipboard

How to get language code of selected country?

Open dDHuy4298 opened this issue 5 years ago • 3 comments
trafficstars

i have problem when call ccp.getLanguageToApply().getCode() function. This always returns default language code of my device. How can i get the language code of selected country? Have i missed something? Hope you reply soon!

dDHuy4298 avatar Nov 30 '19 10:11 dDHuy4298

Can you please post the xml + java/kotlin config?

On Sat, Nov 30, 2019, 03:01 Đức Huy [email protected] wrote:

i have problem when call ccp.getLanguageToApply().getCode() function. This always returns default language code of my device. How can i get the language code of selected country? Have i missed something? Hope you reply soon!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hbb20/CountryCodePickerProject/issues/361?email_source=notifications&email_token=ABFQ32FXOIQGQXWLG55RKFTQWI2XXA5CNFSM4JTF4QJ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H47V73A, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABFQ32AUFHI74ORKDDSKF7LQWI2XXANCNFSM4JTF4QJQ .

hbb20 avatar Nov 30 '19 15:11 hbb20

i have solved that problem by using getLanguage function of locale! But i have new problem is when i using country code picker as a item of menu, i can not setAutoDetectedLanguage programmatically! ccp = (CountryCodePicker) menu.findItem(R.id.item_country_picker).getActionView(); ccp.setAutoDetectedCountry(true); ccp.changeDefaultLanguage(CountryCodePicker.Language.VIETNAMESE); ccp.setCcpDialogShowNameCode(false); ccp.setCcpDialogShowPhoneCode(false); ccp.setCcpDialogShowTitle(true); ccp.showFullName(false); ccp.showArrow(false); ccp.showNameCode(false); ccp.setShowPhoneCode(false); ccp.setOnCountryChangeListener(this);

dDHuy4298 avatar Dec 02 '19 14:12 dDHuy4298

however i changed default language but it was not vietnamese. So what is the problem here?

dDHuy4298 avatar Dec 02 '19 15:12 dDHuy4298