On last note :

I finally found the Id of this button : android.R.id.button1.
here's my try (succesfull ):
public void onClick(DialogInterface dialog, int whichButton)
{
        Dialog curDialog = (Dialog) dialog;
        Button curButton = (Button) curDialog.findViewById
( android.R.id.button1 );
        curButton.setText("Coucou");
}

Emmanuel
http://androidblogger.blogspot.com/



On Feb 5, 9:09 pm, Emmanuel <[email protected]> wrote:
> R.string.btn_yes is the string that appear on your button.
> Not the id !
>
> findVienwById wants an id !
>
> Emmanuelhttp://androidblogger.blogspot.com/
>
> On Feb 5, 8:35 am, Lucius Fox <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to