Data redaction and truncation

From Google material design documentation

Midline ellipses [• • •] are three-bullet glyphs used to represent numeric truncation and the redaction of sensitive data, such as credit card, debit card, and Social Security numbers.

I. Declare a TextView in the layout of your Activity.


II. Get the characters corresponding to the points and short spaces.

String space = "\u0020";  
String thinSpace = "\u2006";  
String bullet = "\u2022";  

III. Build the final text pattern separating the points with short spaces. Between the text and ellipsis must have two normal spaces, and between the ellipsis and the remaining numbers must be just one short space.

String creditCardFinalDigits = "1234";  
String finalText = "Visa" + space + space + bullet + thinSpace + bullet + thinSpace + bullet + thinSpace + creditCardFinalDigits;  

IV. Add your text to the TextView.

TextView cardTextView = (TextView) findViewById(;  

Data truncation with baseline ellipses

From Google material design documentación

Baseline ellipses [...] represent letters, words or phrases that aren’t shown. They also represent text truncation of a name or email address.

To automatically place ellipses depending on the space available:

I. Declare a TextView in the layout of your Activity with the attributes lines="1" and ellipsize="end".


II. Add a large text to the TextView.

TextView titleTextView = (TextView) findViewById(;  

Article originally written by Rafa Vázquez at