5

i have a little problem by printing the complement symbol in android.

 char c = '\u2216'; 
 // should be the unicode for complement
 textView2.setText(c); 
 // gives out "" nothing
 // if i take
 c = '\u2229'
 // it works

But why i cant print out the complement symbol, where is the mistake ? if someone has a solution, it would be very nice to shar it. Thanks !

devlog101010
  • 73
  • 1
  • 9
  • can you tell me which special charecter – Preethi Rao Jun 09 '15 at 10:51
  • I want to print out the complement, the unicode symbol is 2216 doesnt work. But if i take 2229 it gives out the right unicode symbol. But for 2216 it doesnt print out the right symbol, its empty int the textView – devlog101010 Jun 09 '15 at 10:54
  • I find out, that: Android Studio ask if "textView2.setText('u\2216');" should be converted in unicode. if i agree, the right symbol appears. But normally, this also works with char c = '\u...' but not for all of my symbols. Only for a few – devlog101010 Jun 09 '15 at 11:01
  • i think the font problem. a font may not define all Unicode characters. – Jiang YD Jun 09 '15 at 11:10

2 Answers2

3

I think its a font issue .. the font used by Android studio supports that character while the android device (propably Robot font family) doesn't include that glyph.. solution would be to use proper font.

Here how to add custom typeface to your project : https://stackoverflow.com/a/27588966/2267723.

Here is the list of fonts support that character (U+2216): http://www.fileformat.info/info/unicode/char/2216/fontsupport.htm

Community
  • 1
  • 1
Maher Abuthraa
  • 17,493
  • 11
  • 81
  • 103
0

Because your device's font doesn't support that character "∩", you will need to embed a font which support that character.

Typeface tf = Typeface.createFromAsset(context.getAssets(), "yourfontname.ttf");
//You will need to copy the font to assets folder.
textView2.setTypeface(tf);
Myat Min Soe
  • 787
  • 8
  • 32