Android – Identifying RTL language in Android

androidright-to-left

Is there a way to identify RTL (right-to-left) language, apart from testing language code against all RTL languages?

Since API 17+ allows several resources for RTL and LTR, I assume, there should be a way, at least from API 17.

Best Answer

Get it from Configuration.getLayoutDirection():

Configuration config = getResources().getConfiguration();
if(config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
    //in Right To Left layout
}