void 对于变量 OnClick 是无效部类是什么意思呢
void 对于变量 OnClick 是无效类型是什么意思呢
package mart.sudoku;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
public abstract class SudokuActivity extends Activity implements OnClickListener{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
View continueButton = findViewById(R.id.continue_button);
continueButton.setOnClickListener(this);
View newButton=findViewById(R.id.new_button);
newButton.setOnClickListener(this);
View aboutButton=findViewById(R.id.about_button);
aboutButton.setOnClickListener(this);
View exitbutton=findViewById(R.id.exit_button);
exitbutton.setOnClickListener(this);
public void OnClick(View v){
switch(v.getId()){
case R.id.about_button:
Intent i =new Intent(this,About.class);
startActivity(i);
break;
}
}
}
}
------解决方案--------------------
真晕,和我一样的马虎。
package mart.sudoku;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
public abstract class SudokuActivity extends Activity implements OnClickListener{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
View continueButton = findViewById(R.id.continue_button);
continueButton.setOnClickListener(this);
View newButton=findViewById(R.id.new_button);
newButton.setOnClickListener(this);
View aboutButton=findViewById(R.id.about_button);
aboutButton.setOnClickListener(this);
View exitbutton=findViewById(R.id.exit_button);
exitbutton.setOnClickListener(this);
public void OnClick(View v){
switch(v.getId()){
case R.id.about_button:
Intent i =new Intent(this,About.class);
startActivity(i);
break;
}
}
}
}
------解决方案--------------------
真晕,和我一样的马虎。