get resource String ID - Android App

Android examples for App:Resource

Description

get resource String ID

Demo Code


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

public class Main {
    public static int getStringID(Context context, String key) {
        return context.getResources().getIdentifier(key, "string",
                context.getPackageName());
    }//  w w w  .j av a 2 s .  c o  m
}

Related Tutorials