-
调用Button
1.res-layout: android:onClick="Button"
2.src:public void Button(View view){ Toast.makeText(this,"内容",1).show(); }
-
匿名类
src:
Button b1; b1=(Button)findViewById(R.id.button); b1.setOnClickListen(new OnClickListen){ Toast.makeText("文件名".this,"内容",1).show();}
-
内部类
src:
Button b1; b1.(Button)findViewById(R.id.button); button button=new Button(); b1.setOnClickListen(button); class button impements OnClickListen{ public void OnClick(View arg0){ Toast.makeText("文件名".this,"内容",1).show();}