title: Phone number format for EditText
body: <p>I am using library <a href="https://github.com/RedMadRobot/input-mask-android" rel="nofollow noreferrer">input-mask-android</a>  to format the text as user is typing.<br />
  I have an array of phone number masks. By default, the very first mask in the array is selected. The user can choose a different mask using the Spinner. But when the user selects a mask using the Spinner, it does not work as he would like.
  Suppose the array of masks contains two masks: [&quot;+12 - ###&quot;, &quot;+34 - ###&quot;]. If the user selects the second mask, then the following will appear when typing into the EditText:
  Entered 5 will:
  +34-512.<br />
  That is, after entering it will automatically put the key characters of the previous mask.<br />
  My code in Kotlin:</p>
  <pre><code>        val listener: MaskedTextChangedListener = installOn(
                  etPhoneNumber!!,
                  maskT,
                  affineFormats, AffinityCalculationStrategy.PREFIX,
                  object : ValueListener {
                      override fun onTextChanged(
                              maskFilled: Boolean,
                              extractedValue: String,
                              formattedValue: String
                      ) {
                          logValueListener(maskFilled, extractedValue, formattedValue)
                          Log.e(&quot;CHANGE FORMAT:&quot;, affineFormats.toString())
                      }
                  }
          )
  </code></pre>
  <p>maskT - is the selected mask
  affineFormats - dynamic array where the last mask is stored.
  Any suggestions would be greatly appreciated.</p>