Java tutorial
//package com.java2s; import android.annotation.TargetApi; import android.app.Activity; import android.os.Build; import android.view.View; public class Main { @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public static void forceRTLIfSupported(Activity activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { activity.getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL); } } }