package Ġcom . s antal u . sample Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġcom . s antal u . mask edit text . Mask Text Watcher Ċ import Ġkotlinx . android . synt hetic . main . activity _ main . et Credit Cart Ċ import Ġkotlinx . android . synt hetic . main . activity _ main . et Custom Ċ import Ġkotlinx . android . synt hetic . main . activity _ main . et Date Ċ import Ġkotlinx . android . synt hetic . main . activity _ main . et PhoneNumber Ċ import Ġkotlinx . android . synt hetic . main . activity _ main . show Ċ import Ġkotlinx . android . synt hetic . main . activity _ main . tv Credit Cart Ċ import Ġkotlinx . android . synt hetic . main . activity _ main . tv Custom Ċ import Ġkotlinx . android . synt hetic . main . activity _ main . tv Date Ċ import Ġkotlinx . android . synt hetic . main . activity _ main . tv PhoneNumber Ċ Ċ class ĠMainActivity Ġ: ĠAppCompatActivity () Ġ{ ĊĊĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠ ĠsetContentView ( R . layout . activity _ main ) ĊĊĠĠĠ Ġval Ġtext Watcher Ġ= ĠMask Text Watcher ( et Custom , Ġ" #### Ġ#### ") ĊĠĠĠ Ġet Custom . add TextChanged Listener ( text Watcher ) ĊĊĠĠĠ Ġshow . setOnClickListener Ġ{ ĊĠĠĠĠĠ Ġtv Custom . text Ġ= Ġtext Watcher . un format ( et Custom . text ) ĊĠĠĠĠĠ Ġtv Credit Cart . text Ġ= Ġet Credit Cart . raw Text ĊĠĠĠĠĠ Ġtv PhoneNumber . text Ġ= Ġet PhoneNumber . raw Text ĊĠĠĠĠĠ Ġtv Date . text Ġ= Ġet Date . raw Text ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ