Java tutorial
//package com.java2s; import android.content.Context; public class Main { public static String parseString(Context context, Object obj) { if (obj != null) { if (obj instanceof String) { return obj.toString(); } else if (obj instanceof Integer) { return context.getString((Integer) obj); } } return null; } }