2 Answers2

2
  1. Go to your "YourProjectFolder/app/src/main/res" folder, then
  2. Create a folder named "values-ur" folder in res folder
  3. Create file "strings.xml" inside values-ur
  4. Inside that strings.xml add your strings,eg:

"urdu_text" is your urdu strings.

In your Activity class take getString(R.string.text_one), and if you have a textview, textview.setText(getString(R.string.text_one));

For more info : https://developer.android.com/guide/topics/resources/localization.html

dev
  • 260
  • 2
  • 12
  • I am very beginner. I don't know what are you saying... Can you please explain it....? – Shakeel Mughal Apr 02 '18 at 14:51
  • Not able to save these strings in **strings.xml** file – Shakeel Mughal Apr 05 '18 at 03:32
  • What is the error. check syntax for declaring a string is correct or not – dev Apr 05 '18 at 04:28
  • When I am going to save this string. ** میں ایک پاکستانی ہوں ** But receiving this error C:\Users\Shakeel Mughal\AndroidStudioProjects\AssanIslam\app\src\main\res\values-ur\strings.xml This file contains character in Unicode format which will be lost if you save this file as an ANSI encoded text file. To keep the Unicode information, click Cancel below and then select one of the Unicode options from the Encoding drop down list. Continue? – Shakeel Mughal Apr 05 '18 at 16:51
  • check any of your strings have special characters like "&" or something..and also your folder name should be values-ur inside res folder.. – dev Apr 06 '18 at 04:53
  • I did it. Thanks **Sir** dev – Shakeel Mughal Apr 06 '18 at 16:34
  • Happy to help..Pls upvote – dev Apr 07 '18 at 01:50
  • Sir dev.... How I add urdu fonts in my project? – Shakeel Mughal Apr 09 '18 at 02:35
  • https://stackoverflow.com/questions/27588965/how-to-use-custom-font-in-android-studio This link will help – dev Apr 09 '18 at 09:41
1

You just required to have all text in urdu unicode. Android Activity, layouts supports urdu. sqlite3 also supports urdu.