Java tutorial
//package com.java2s; import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.os.Build; import android.view.Gravity; public class Main { @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @SuppressLint("RtlHardcoded") public static int getGravityEnd() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { return Gravity.END; } return Gravity.RIGHT; } }