0

I actually wand to type Arabic,Is it possible ? I am creating an android application.And i am new to it.please help. i tried these code it didn't work.

if(UTILSSessionVariables.LCID==2057)
        {
        setContentView(R.layout.passportdocumentfields);
 LastName.setGravity(Gravity.LEFT);
        }
else if(UTILSSessionVariables.LCID==3801)
        {
            setContentView(R.layout.arabicpassportdetails);

            LastName.setGravity(Gravity.RIGHT);
        } 
Abhi
  • 101
  • 1
  • 4
  • 11

2 Answers2

1

Use a Bidi object to get the information on the position reordering of a bidirectional text, such as Arabic or Hebrew. The natural display ordering of horizontal text in these languages is from right to left, while they order numbers from left to right.

Read the below document :-

http://developer.android.com/reference/java/text/Bidi.html

or

android:textDirection="anyRtl"

http://android-developers.blogspot.in/2013/03/native-rtl-support-in-android-42.html

duggu
  • 37,851
  • 12
  • 116
  • 113
  • android:supportsRtl="true" is showing error in my application manifest – Abhi Jun 19 '14 at 08:00
  • what is your minimum version application ? – duggu Jun 19 '14 at 08:02
  • minimum 2.3.3 and target is 4.2 – Abhi Jun 19 '14 at 08:15
  • android:supportsRtl="true" this one is also showing error in my manifest. – Abhi Jun 19 '14 at 08:44
  • Native RTL support in Android 4.2 ? – duggu Jun 19 '14 at 09:06
  • I tried this code but it is't working String languageToLoad="ar"; Locale locale = new Locale(languageToLoad); Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale; getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics()); – Abhi Jun 19 '14 at 09:30
  • Thanks... Have been banging my head against a wall for AGES trying to work out why rtl wouldn't work for numbers. – Ben Mar 07 '18 at 16:39
0

If the locale of the phone is set to a right to left language, it will do this automatically. At least for all phones 4.0 and higher. Before then there was actually a special patch to the framework that provided that feature that was applied to all phones going to RTL regions, which means it would work on 2.3 phones from those areas, but not on phones without the patch. Of course this means phones without that patch just won't work and there's no real way to fake it, since AFAIK there's no way to tell if the phone has the patch or not.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • but am using both Arabic and English languages in one application.how can i get the locale ? i used this , it showing only English Locale.getDefault().getDisplayLanguage(); – Abhi Jun 19 '14 at 07:49