As long as xml.GetDrawable return type is a BitmapDrawable. If it isn't (e.g. if return type is an Object), then not possible, and you'll still need the drawBtnCancel variable in order to cast the result from xml.getDrawable to a BitmapDrawable type.