How to set the button background image through code
for set background image for button which is in drawable folder then use below code
btn.setBackgroundResource(R.drawable.new_todo_image);
Try this:
btn.setBackgroundDrawable(getResources().getDrawable(R.drawable.new_todo_image));