get Res String Id By Name - Android App

Android examples for App:Resource

Description

get Res String Id By Name

Demo Code


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

public class Main {
    public static int getResStringIdByName(Context context, String name) {
        return context.getResources().getIdentifier(
                context.getPackageName() + ":string/" + name, null, null);
    }//w  w w .j  a  va2s.  c  o  m
}

Related Tutorials