How to show first 12 digits to asterisk and last 4 as digits
<p>I have <code>EditText</code> to enter credit card number. I just want to secure first 12 digits and last 4 digits as normal. There should be spaces in between as well. Like the image below:</p>

<p><a href="https://i.stack.imgur.com/GOHZJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GOHZJ.png" alt="enter image description here"></a></p>

<p>And card numbers should be extractable from the <code>EditText</code> ie, if <code>editText.getText()</code> should return the whole card number. Please help on this.</p>