I am trying to set the options for radio buttons to be images in Android. Basically I have 4 images at four different file paths which I want to set to four radio buttons (Not the button itself, but the actual option to select next to it). For text I just do textview cast and add text to the button like this
TextView option2 = (TextView) getView().findViewById(R.id.answer2);
option2.setText(secondOption.substring(5));
But what do I do for images, it does not allow me to cast the radiobutton with imageview. So something like this
ImageView option2 = (ImageView) getView()
.findViewById(R.id.answer2);
option2.setImageBitmap(BitmapFactory.decodeFile(firstOption
.substring(5)));
I did not find a good option so I ended up setting the text to blank and then the setting the left drawable to the image for the radio button