Java tutorial
//package com.java2s; import android.graphics.ColorMatrix; import android.graphics.ColorMatrixColorFilter; import android.graphics.drawable.Drawable; public class Main { public static void doGray(Drawable d) { //Make this drawable mutable. //A mutable drawable is guaranteed to not share its state with any other drawable. d.mutate(); ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); ColorMatrixColorFilter cf = new ColorMatrixColorFilter(cm); d.setColorFilter(cf); } }