Code example for PhoneNumberFormattingTextWatcher

2
    public static final int LOGIN_SUCCESSFUL = 0x3333;
    public static final int LOGIN_FAILED = 0x4444;
    public static final int LOGIN_CANCELLED = 0x5555;
     
    EditText mPhoneNumberEntry;
    PhoneNumberFormattingTextWatcher mPhoneWatcher = new PhoneNumberFormattingTextWatcher();
 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_authorize);
 
        mPhoneNumberEntry = (EditText) findViewById(R.id.phone_number_entry);
        mPhoneNumberEntry.addTextChangedListener(mPhoneWatcher);
         
        SharedPreferences preferences = getSharedPreferences("groupme.prefs", MODE_PRIVATE);
 
        if (preferences.getBoolean("needs.pin", false)) {
            Intent intent = new Intent(this, PinEntryActivity.class);
            intent.putExtra("phone_number", preferences.getString("phone.number", ""));