Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different language on textview in Android

how can i write different language (Bangla) on textview or edittext in Android and for this What version of API i have to need

like image 615
Toukir Naim Avatar asked May 14 '11 16:05

Toukir Naim


2 Answers

If you use strings.xml to add a level of indirection for string values, then you can easily localize your strings as in:

android:text="@string/main_text_view_hello"

So I have a strings.xml in folders:

res/values
res/values-en-rCa
res/values-en-rGB

Any time I want to change a value for Canada or United Kingdom, I just add it to the appropriate folder. All other values are obtained by default from res/values.

like image 152
JAL Avatar answered Oct 09 '22 04:10

JAL


You can set text with TextView.setText(String-ID) . String-IDs are managed in strings.xml files which are under res/values folder. If you want another language for example german you need another strings.xml file with the same String-IDs in res/values-de. In android layout files you can reference such string ids with @string/stringid.

like image 33
ludwigm Avatar answered Oct 09 '22 04:10

ludwigm