Android Open Source - MaskedEditText Masked Edit Text Example Activity






From Project

Back to project page MaskedEditText.

License

The source code is released under:

MIT License

If you think the Android project MaskedEditText listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package br.com.sapereaude.maskedEditText;
/*from   w ww .  j  a v a 2s  . co m*/
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class MaskedEditTextExampleActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        final MaskedEditText changingText = (MaskedEditText) findViewById(R.id.changingText);
        findViewById(R.id.charRepButton).setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        if(changingText.getCharRepresentation() == 'a')
          changingText.setCharRepresentation('b');
        else if(changingText.getCharRepresentation() == 'b')
          changingText.setCharRepresentation('a');
      }
    });
        findViewById(R.id.maskButton).setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        if(changingText.getMask().equals("abababab")) {
          changingText.setMask("aabbaabb");
          changingText.setHint("aabbaabb");
        }
        else if(changingText.getMask().equals("aabbaabb")) {
          changingText.setMask("abababab");
          changingText.setHint("abababab");
        }
      }
    });
    }
}




Java Source Code List

br.com.sapereaude.maskedEditText.MaskedEditTextExampleActivity.java
br.com.sapereaude.maskedEditText.MaskedEditText.java
br.com.sapereaude.maskedEditText.Range.java
br.com.sapereaude.maskedEditText.RawText.java