Java tutorial
//package com.java2s; import android.widget.TextView; public class Main { public static boolean setTextCompoundDrawableWithCatchOOM(TextView tv, int left, int top, int right, int bottom) { if (tv == null) return false; try { tv.setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom); return true; } catch (OutOfMemoryError e) { return false; } } }