想詢問使用 Android Studio 的錯誤
是使用 Android Studio 寫的 跟老師教學的不一樣 想問問 紅箭頭處 怎會錯誤!! 感謝
====
package com.example.user.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private Button bt1;
private Button bt2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bt1 =(Button) findViewById(R.id.button1);
bt1 =(Button) findViewById(R.id.button2);
bt1.setOnClickListener(new oit(){
@Override
public void onClick(View v){
super.onClick(v);
Toast.makeText(MainActivity.this,"bt1要執行的邏輯",1).show();
}
});
}
}
class oit implements View.OnClickListener{
@Override
public void onClick(View v){
Log.i("tag","父類的onclick事件")
}
}