Hi all,

first of all, let me introduce my self. My name is Teguh, currently
I'm new to android and trying to develop an application in android.
At the moment I found an issue while using a listener..

code issue : (this code will generate an error when launching the
application)

public class Sudoku extends Activity implements OnClickListener{
         private static final String TAG = "Sudoku";

        @Override
        public void onCreate(Bundle savedInstanceState){
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);

                //Set up click listeners for all the buttons
                View continueButton = findViewById(R.id.continue_button);
                continueButton.setOnClickListener(this);
                View newButton = findViewById(R.id.new_button);
                newButton.setOnClickListener(this);
                View aboutButton = findViewById(R.id.about_button);
                aboutButton.setOnClickListener(this);
                View exitButton = findViewById(R.id.exit_button);
                exitButton.setOnClickListener(this);

        }

        @Override
        public void onClick(View v) {
                // TODO Auto-generated method stub
                switch (v.getId()){
                case R.id.about_button:
                        Intent i = new Intent(this, About.class);
                        startActivity(i);
                        break;
                }
        }
}

code OK: (i removed the listener, and running successfully when
initialize)

public class Sudoku extends Activity implements OnClickListener{
         private static final String TAG = "Sudoku";

        @Override
        public void onCreate(Bundle savedInstanceState){
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
        }

        @Override
        public void onClick(View v) {
                // TODO Auto-generated method stub
                switch (v.getId()){
                case R.id.about_button:
                        Intent i = new Intent(this, About.class);
                        startActivity(i);
                        break;
                }
        }
}

-----------------------------
Does anybody know what was happened to the code?
the error comes in initialize mode of this application.

Thank you very much for all of you attention.

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