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.Context;

public class Main {
    public static String getLocalizedPokemonName(String name, Context context) {
        if (name == null || context == null) {
            return name;
        }

        try {
            String sname = name.toLowerCase();
            int id = context.getResources().getIdentifier(sname, "string", context.getPackageName());
            return id != 0 ? context.getResources().getString(id) : name;
        } catch (Exception e) {
        }
        return name;
    }
}