报的错误是
The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (MainActivity.mClick)
------------------------------------
The type MainActivity.mClick must implement the inherited abstract method DialogInterface.OnClickListener.onClick(DialogInterface, int)
代码是比这书上敲的 很简单
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txt = (TextView) findViewById(R.id.shishi);
button = (Button) findViewById(R.id.button);
button.setOnClickListener(new mClick());
}
class mClick implements OnClickListener {
public void onClick(View v) {
MainActivity.this.setTitle("改变标题");
txt.setText(R.string.Str1);
}
}