0

Generally, I'm trying to save some text from edittext in android studio to string and than later write it to pdf using pdf stamper and send it via e-mail. I'm using default encoding UTF-8 because I cannot (or don't know) to change it since it's hard-coded. User will eventually enter some of these characters. What is the best way to make this characters visible or to prevent user from typing those characters?

Thanks :)

  • Possible duplicate of [Unicode characters not displayed in TextView.setText](https://stackoverflow.com/questions/4522337/unicode-characters-not-displayed-in-textview-settext) – Andrii Omelchenko Aug 16 '17 at 09:56

3 Answers3

0

Use special characters and set it to text view like how u set & :- &

or use Html within TextView :-

#For example (< Android Nougat):
myTextView.setText(Html.fromHtml("&#269;"));


#For example (>= Android Nougat):    
myTextView.setText(Html.fromHtml("&#269;", Html.FROM_HTML_MODE_COMPACT));
Nidhin Prathap
  • 696
  • 5
  • 15
  • So you suggest that I, if my edittext is declared as ts, write i.e. ts.setText(Html.fromHtml("č", Html.FROM_HTML_MODE_COMPACT)); for character č, and do this for all other characters I have problem with? – PostarLakogSna Aug 16 '17 at 10:21
  • yes that should work.. or in strings.xml add č and use it in ur view – Nidhin Prathap Aug 16 '17 at 10:57
0

try this,

myTextView.setText(Html.fromHtml("&#269;"));

Sanjay Kumaar
  • 690
  • 7
  • 17
0

You can save it to xml as

<string name="random">" č,ć,đ,ž"</string>

and you it later by string name