我在this.viewcam.setOnClickListerner(new view.OnClickListerner())
行中收到以下错误
我在eclipse中得到了这个错误。
此行有多个标记
setOnClickListener(View.OnClickListener)
中的方法View
不适用于参数(new OnClickListener(){}
) public class Main extends Activity
implements View.OnClickListener
{
Button viewcam;
EditText editTextIp;
EditText login;
EditText passwd;
public void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
setContentView(R.layout.main);
this.viewcam = ((Button)findViewById(R.id.viewcam));
this.viewcam.setOnClickListener(new view.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
if (v == this.viewcam)
{
Log.i("login", this.login.getText().toString());
Log.i("Passwd", this.passwd.getText().toString());
Intent localIntent1 = new Intent(v.getContext(), MjpegSample.class);
Log.i("My ip", this.editTextIp.getText().toString());
localIntent1.putExtra("ip", "http://" + this.editTextIp.getText().toString() + "/");
localIntent1.putExtra("user", this.login.getText().toString());
localIntent1.putExtra("passwd", this.passwd.getText().toString());
startActivityForResult(localIntent1, 1000);
} }
});
this.editTextIp = ((EditText)findViewById(R.id.ip));
this.login = ((EditText)findViewById(R.id.username));
this.passwd = ((EditText)findViewById(R.id.password));
}
}
答案 0 :(得分:1)
更改
this.viewcam.setOnClickListener(new view.OnClickListener() {
要
this.viewcam.setOnClickListener(new OnClickListener() {
答案 1 :(得分:0)
您需要在
中大写查看this.viewcam.setOnClickListener(new view.OnClickListener() {
所以它应该是
this.viewcam.setOnClickListener(new View.OnClickListener() {