Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.res.AssetManager;

import java.io.InputStream;

import java.util.Locale;

public class Main {
    public static String getLocalizedAssetPath(AssetManager assetManager, String pathTemplate) {
        String path = String.format(Locale.US, pathTemplate, "-" + Locale.getDefault().getLanguage().toLowerCase());

        try {
            InputStream is = assetManager.open(path);
            is.close();
        } catch (Exception ex) {
            path = String.format(Locale.US, pathTemplate, "");
        }

        return "file:///android_asset/" + path;
    }
}