Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;

import android.content.res.Configuration;
import android.content.res.Resources;
import java.util.Locale;

public class Main {
    public static void updateApplicationResourceLocale(Context context, Locale locale) {
        Resources resources = context.getResources();
        Configuration configuration = resources.getConfiguration();
        if (!configuration.locale.equals(locale)) {
            android.util.DisplayMetrics displaymetrics = resources.getDisplayMetrics();
            configuration.locale = locale;
            resources.updateConfiguration(configuration, displaymetrics);
            Resources.getSystem().updateConfiguration(configuration, displaymetrics);
        }
    }
}