I have written code to setFocus to ALert Dialog negative button by using requestFocus(). But the button color will not change.I can able to set background image to that butt
Just setOnShowListener() to AlertDialog, and set focus on the negative button.
alertDialog.setOnShowListener(new DialogInterface.OnShowListener(){
@Override
public void onShow(DialogInterface dialog) {
Button negative = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
negative.setFocusable(true);
negative.setFocusableInTouchMode(true);
negative.requestFocus();
}
});
alertDialog.show();