R.string.btn_yes is the string that appear on your button. Not the id ! findVienwById wants an id !
Emmanuel http://androidblogger.blogspot.com/ On Feb 5, 8:35 am, Lucius Fox <lucius.fo...@gmail.com> wrote: > Hi, > > I create a dialog using this: > > Dialog d = new AlertDialog.Builder(MyActivity.this) > .setPositiveButton(R.string.btn_yes, new > DialogInterface.OnClickListener() { > public void onClick(DialogInterface dialog, int > whichButton) { > dummy(); > } > }) > > Then I try to get the 'yes' button using this: > Button yesButton = (Button)d.findViewById(R.string.btn_yes); > > But I get null for my 'yesButton'. > > Any idea why findViewById does not work? And if not, how can I get a > reference to yes button of the dialog? > > Thank you. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---