Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Locale;

import android.content.Context;

import android.content.res.Configuration;

public class Main {
    /**
     * Update language
     * 
     * @param code The language code. Like: en, cz, iw, ...
     */
    public static void updateLanguage(Context context, String code) {
        Locale locale = new Locale(code);
        Locale.setDefault(locale);
        Configuration config = new Configuration();
        config.locale = locale;
        context.getResources().updateConfiguration(config, context.getResources().getDisplayMetrics());
    }
}