AlertDialog getButton() Returns Null

If you encounter a NullPointerException error whenever you call getButton() of an AlertDialog in Android to get a reference to either the positive or negative button, the solution is very simple.

Make sure you call AlertDialog.show() first before you call getButton().

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *