Code example for PhoneNumberFormattingTextWatcher

        private final Handler mHandler;
        private static final int MSG_GET_TEXT_WATCHER = 1;
        public TextWatcherLoadAsyncTask(String countryCode, TextView textView, Handler handler) {
            mCountryCode = countryCode;
            mTextView = textView;
            mHandler = handler;
        protected PhoneNumberFormattingTextWatcher doInBackground(Void... params) {
            return new PhoneNumberFormattingTextWatcherEx(mCountryCode);
        protected void onPostExecute(PhoneNumberFormattingTextWatcher watcher) {
            if (watcher == null || isCancelled()) {
                return; // May happen if we cancel the task. 
            // Setting a text changed listener is safe even after the view is detached. 
Connect your IDE to all the code out there  Get Codota for Java