SetOnClickListener 有错误。它表示方法 SetOnClickListener(new View.OnClickListener(){}) 未定义 TextView 类型。为什么?
package com.example.testing;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class RegisterActivity extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//Set View to register.xml
setContentView(R.layout.register);
TextView loginScreen = (TextView) findViewById (R.id.link_to_login);
//Listening to Login Screen Link
loginScreen.SetOnClickListener(new View.OnClickListener()
{
public void onClick(View arg0)
{
//Closing reg screen
//Switching to Login Screen/closing reg screen
finish();
}
});
}
}