How to make a button that shows the backspace (⌫) character on Android?

android, backspace, java, special-characters, xml

Solution

Seems like the default Android font (Roboto / droid sans serif) doesn't include this character, so it can't display it (I still haven't figured out how the preview shows it). So you need to find a font that supports this character. The best candidate I've found is Arial Unicode MS, but these work too:

- Quivira (free)

- Symbola

- Segoe UI (windows phone's)

- DejaVu sans (free)

- Apple Symbols

Problem

I'm trying to use the ⌫ character as my backspace symbol in my android app. When I just copy and paste this character as the text value of my Button it works and shows the symbol in the simulator, but when I try to set this character dynamically in Java or when I try to use the Basic Latin value of it (`\u232b`) it just shows whitespace. This is when I use the XML editor and my `strings.xml` value: My `strings.xml`: ``` <?xml version="1.0" encoding="utf-8"?> <resources> <string name="backSpace">⌫</string> </resources> ``` In Java I tried hardcoding it like this, but they all result in whitespace: ``` ((Button) mView.findViewById(R.id.buttonClear)).setText("⌫"); ((Button) mView.findViewById(R.id.buttonClear)).setText("\u232b");` ((Button) mView.findViewById(R.id.buttonClear)).setText('\u232b'+"");` ```

Original source

Related problems