Java tutorial
//package com.java2s; import java.util.Locale; import android.content.Context; public class Main { public static int getLocalLauguage(Context context) { int code = 0; Locale local = context.getResources().getConfiguration().locale; String s = local.getLanguage(); if (s.equals("en")) { code = 2; } else if (s.equals("zh")) { code = 1; } return code; } }