在我的安卓應用裡面有報錯:
The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (MainActivity)
我的代碼很簡單,找不到錯誤在那兒?謝謝好心人幫忙指點:
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_myActivity);
View continue = findViewById(R.id.ContinueBtn);
continue.setOnClickListener(this);
}
}
public class MainActivity extends Activity implements OnClickListener
傳遞給setOnClickListener需要用onclicklistenere。