imageButton.setImageDrawable(getResources().getDrawable(R.drawable.img)); imageButton.setImageResource(R.drawable.img);