I have a school project where I am trying to get a flashlight app going. For the on/off ImageButton, I want to have 4 custom images.
If flashlight is off: -turn_on.png (
Is it a requirement that it has to be imageResource? You can try using backgroundResource instead.
ImageButton flashButtonOn = (ImageButton) findViewById(R.id.flashButtonOn);
flashButtonOn.setBackgroundResource(R.drawable.on_selector);
Or try
flashButtonOn.setImageResource(R.drawable.replacementGraphic);