我想創建2或android系統中超過2兩按鈕,但我在這行如何創建2個或2個以上按鈕的Android
View btnClick = findViewById(R.id.buttonClick);
View btnscan = findViewById(R.id.btscanClick);
//set event listener
btnClick.setOnClickListener(this);
}
//override the OnClickListener interface method
@Override
public void onClick(View arg0) {
if(arg0.getId() == R.id.buttonClick){
//define a new Intent for the second Activity
Intent intent = new Intent(this,SecondActivity.class);
//start the second Activity
this.startActivity(intent);
public void onClick1(View arg1) {
if(arg1.getId() == R.id.btscanClick){
//define a new Intent for the second Activity
Intent intent = new Intent(this,ScanActivity.class);
//start the second Activity
this.startActivity(intent);
你得到了哪個問題,並在哪一行?發佈logcat。 –
發佈您的清單文件。 –
發佈您的logcat文件.... – User11