Java tutorial
//package com.java2s; import android.content.res.Resources; public class Main { static String getOptionalStringResource(Resources resources, int stringResourceId, String defaultString) { try { return resources.getString(stringResourceId); } catch (Resources.NotFoundException e) { return defaultString; } } }