All my other On Click methods work except the ones the I have to
inflate the layout "to get the button". What should I do to make this
work? Or is it just my code that is wrong?

Here are how I define my On Click listeners for the problem buttons:

Button updateLevel =
(Button)getLayoutInflater().inflate(R.layout.level,
null).findViewById(R.id.updateLevel);

        updateLevel.setOnClickListener(new View.OnClickListener() {

                        @Override
                        public void onClick(View v) {
                                setLevelOnClick(v);

                        }
                });

   Button goBackMainMenu = (Button)
getLayoutInflater().inflate(R.layout.play,
null).findViewById(R.id.tomenu);
        goBackMainMenu.setOnClickListener(new View.OnClickListener() {

                        @Override
                        public void onClick(View v) {
                                toMenuOnClick(v);

                        }
                });

Here are my onClick actions:

protected void toMenuOnClick(View v) {
                setContentView(R.layout.main);

        }




        protected void setLevelOnClick(View v) {

                setContentView(R.layout.main);


        }

What is wrong?

-- 
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