public void setImageBlack(){
Drawable mDrawable = getResources().getDrawable(R.drawable.ic_launcher);
//Make this drawable mutable.
//A mutable drawable is guaranteed to not share its state with any other drawable.
mDrawable.mutate();
ColorMatrix cm = new ColorMatrix();
cm.setSaturation(0);
ColorMatrixColorFilter cf = new ColorMatrixColorFilter(cm);
mDrawable.setColorFilter(cf);
layout1.setBackgroundDrawable(mDrawable);
}
Drawable mDrawable = getResources().getDrawable(R.drawable.ic_launcher);
//Make this drawable mutable.
//A mutable drawable is guaranteed to not share its state with any other drawable.
mDrawable.mutate();
ColorMatrix cm = new ColorMatrix();
cm.setSaturation(0);
ColorMatrixColorFilter cf = new ColorMatrixColorFilter(cm);
mDrawable.setColorFilter(cf);
layout1.setBackgroundDrawable(mDrawable);
}