我正在创建一个 Android应用程序,在我的上一个问题( Android app not able to open web link)之后,我在Eclipse中遇到了这个语法错误: Cannot instantiate the type View.OnClickListener 我的代码如下: package c
          Cannot instantiate the type View.OnClickListener
我的代码如下:
package com.example.ldsm3;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.method.MovementMethod;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class Finished extends Activity {
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_finished);
        // tv is the ID for the TextView in the XML file
        TextView tv = (TextView) findViewById(R.id.textView2); 
        // set the TextView to show the score
        tv.setText(Misc.correct + "/" + Misc.total);
        Button button1 = (Button) findViewById(R.id.button1);
        button1.setOnClickListener(new Button.OnClickListener()); 
    }
    public void onClick(View v) 
    {
        // Open up the system's default browser to whackamole.ajav-games.tk, where the Whack A Mole game is.
        Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://whackamole.ajav-games.tk"));
        startActivity(browserIntent);
    }
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.finished, menu);
        return true;
    }
} 
 我该如何解决?我知道这可能是一个简单的Java错误,但我之前没有使用过Java,并且在提到Java语法,术语等时请解释它们.
尝试这样代替button1.setOnClickListener(new Button.OnClickListener());button1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
        // TODO your code
    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://whackamole.ajav-games.tk"));
        startActivity(browserIntent);
        };
    });
        
             