Everything works fine. My code as below copied from Google’s guide. My problem is, is it possible to change the colour of the text int he Alert? For example “RED” string should be red, “Green” string should be green etc. Thanks in advance.
final CharSequence[] items = {"Red", "Green", "Blue"};
AlertDialog.Builder builder = new AlertDialog.Builder(BuilderActivity.this);
builder.setTitle("Pick a color");
builder.setSingleChoiceItems(items, -1, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
});
builder.show();
It is possible, try to provide custom implementation of ListAdapter to the setSingleChoiceItems(ListAdapter adapter, int checkedItem, DialogInterface.OnClickListener listener). Override adapter’s getView() method and change text color of resulting view appropriately.