我想创建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