alertDialog.getButton() method gives null pointer exception android

Take a look here for the answer : http://code.google.com/p/android/issues/detail?id=6360

As it says in comment #4 you must call show() on your dialog before you can access the buttons, they are not available beforehand. For an automatic solution on how to modify the buttons as soon as they are ready see Mickeys answer

Leave a Comment