Hi,
Button serverButton = (Button) findViewById(R.id.server);
You're calling findViewById in the activity. You probably want:
Button serverButton = (Button) dl.findViewById(R.id.server);
Cheers,
James
On Thu, Jan 29, 2009 at 12:32 PM, themakos <[email protected]> wrote:
>
> hello i want to make a little app that has a dialog window opening
> when it starts.the problem is that in the dialog window that opens it
> wont let me do anything on the buttons.
> the app wont even start if i try to use any of button.method(); calls
>
> any solutions?
> my code is like this
> [code]
>
> private void showdialog(){
> Dialog dl = new Dialog(this);
> dl.setTitle("Options");
> dl.setContentView(R.layout.infodlg);
> Button serverButton = (Button) findViewById(R.id.server);
> dl.show();
> serverButton.setOnClickListener( new OnClickListener() {
>
> public void onClick(View view) {
>
> potson(sclick);
> if (sclick) serverButton.setBackgroundColor(0xAA00AA00);
> else serverButton.setBackgroundColor(0x0000AA00);
>
> }
> });
>
>
> }
> public void potson(boolean click) {
> if (!click) click=true;
> else click=false;
> }
> [/code]
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---