Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;

public class Main {
    public static String getStringFromXml(Context context, String name) {
        if (context != null) {
            int id = context.getResources().getIdentifier(name, "string", context.getPackageName());
            String text = context.getString(id);
            return text;
        } else {
            return "";
        }
    }
}