5

I know there's this question, but '\u221e' doesn't work for me. Also this is Android-specific. Surely there must be a way to show an infinity sign!

Community
  • 1
  • 1
Oleksiy
  • 33,896
  • 20
  • 72
  • 119

2 Answers2

18

Never mind, found it myself:

DecimalFormatSymbols.getInstance().getInfinity()

Note that it may not work with some custom fonts.

Oleksiy
  • 33,896
  • 20
  • 72
  • 119
  • I use this code in the contains method as a regex and works fantastic. I cant use in regex as infinity sign. – Dezo Nov 06 '20 at 17:40
3

You can create a new item in "strings.xml":

<string name="infinity">&#8734;</string>

And then call it using your Context:

textView.setText(context.getString(R.string.infinity));