Code example for View

Methods: setOnClickListener

    private void setupAnimation(View view, final Animation animation,
            final int animationID) {
        view.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // If the button is checked, load the animation from the given resource 
                // id instead of using the passed-in animation paramter. See the xml files 
                // for the details on those animations. 
                v.startAnimation(mCheckBox.isChecked() ?
                        AnimationUtils.loadAnimation(ViewAnimations.this, animationID) :