tags:

views:

11

answers:

1

The following code was copied from one project to another. No errors in project one. In project 2 I get: -The method onClick(View) of type new View.OnClickListener((){} must override a superclass method -implements androd.view.View.OnClickListener.onClick

The project settings look the same, but I must be missing something.

private Button mCompany = null;

public class About extends Activity{

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.about);
    setTitle(R.string.title_about);

    mCompany = (Button)findViewById(R.id.about_company_button);
    mCompany.setOnClickListener( new OnClickListener() {

        @Override
        public void onClick(View arg0) { 
            Intent intent = new Intent(Intent.ACTION_VIEW);
                             intent.setData(Uri.parse(getResources().getString(R.string.app_company_website)));
            startActivity(intent); 
        }

    });
A: 

Found a solution on another site but I would like to know why this will work. It said to comment out the Override. Actually, it now compiles fine but crashes when the about item is clicked.