get String from Context by id - Android android.content

Android examples for android.content:Context

Description

get String from Context by id

Demo Code

import android.content.Context;
import android.text.TextUtils;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{

    public static String getString(int resId, Context context) {
        String str = "";
        try {// ww w  .  j a v  a2 s  .co m
            str = context.getString(resId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return str;
    }

}

Related Tutorials