Skip to content

Custom Dialog Title | Search Hint | Empty result ACK

Harsh B. Bhakta edited this page Mar 18, 2019 · 2 revisions

To change the title / Search Hint / Empty result acknowledgement message, a CustomDialogTextProvider must be provided.

  • @param language is the currently applied language.
  • @param default<Value> is the library default message text for given language.

If you are not planning to change the message for only specific message or specific language, it is suggested to return defaultValue for other message/language.

This code will do following:

  • Title : For English and Japanese language, it will return custom title and default for other.
  • Hint : Custom hint message for Hindi and default for other.
  • No Result ACK : No customization. Only library defaults.
   ccp.setCustomDialogTextProvider(new CountryCodePicker.CustomDialogTextProvider() {
            @Override
            public String getCCPDialogTitle(CountryCodePicker.Language language, String defaultTitle) {
                switch (language) {
                    case ENGLISH:
                        return "<Custom English Title>";
                    case JAPANESE:
                        return "<Custom Japanese Title>";
                    default:
                        return defaultTitle;
                }
            }

            @Override
            public String getCCPDialogSearchHintText(CountryCodePicker.Language language, String defaultSearchHintText) {
                switch (language) {
                    case HINDI:
                        return "<Custom Hindi Hint>";
                    default:
                        return defaultSearchHintText;
                }
            }

            @Override
            public String getCCPDialogNoResultACK(CountryCodePicker.Language language, String defaultNoResultACK) {
                return defaultNoResultACK;
            }
        });
Clone this wiki locally