例如:如何为他们同时绑定同一个监听器
this.buttonMC=(Button)findViewById(R.button.bMC);
this.buttonMR=(Button)findViewById(R.button.bMR);
this.buttonMAdd=(Button)findViewById(R.button.bMADD);
this.buttonMCut=(Button)findViewById(R.button.bMCUT);
this.buttonDelete=(Button)findViewById(R.button.bDelete);
class onClickListenrGather implements OnClickListener{ @Override
public void onClick(View v) {
}}
this.buttonMC=(Button)findViewById(R.button.bMC);
this.buttonMR=(Button)findViewById(R.button.bMR);
this.buttonMAdd=(Button)findViewById(R.button.bMADD);
this.buttonMCut=(Button)findViewById(R.button.bMCUT);
this.buttonDelete=(Button)findViewById(R.button.bDelete);
class onClickListenrGather implements OnClickListener{ @Override
public void onClick(View v) {
}}
解决方案 »
- 跪求各位大牛帮忙解决!!!!!
- 安卓应用开发应该学习那些东西呢?
- 使用adb.exe 我的笔记本上同时连接了两台 android 手机,我想把pc上一个文件发到m9 的机器上,命令怎么写?
- 在Eclipse中启动Android程序过慢
- 想基于CM7源码一直MIUI不知可否?
- 中国移动的OPhone前景如何?
- 关于Android APP唯一标示的问题
- Android 界面下方的功能条目怎么实现的
- handler获取到了子线程的值,怎么把这个值给json解析然后赋值给adapter,求大神帮忙。。贴图,难了几天。。。。。
- 做了个淘客app,每次浏览商品,返回要重新加载。
- 蓝牙传输问题
- 终止线程的问题
应该跟android的架构有关
if(view.getName() == "xxx")
{
执行操作
}
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;public class TestActivity extends Activity implements OnClickListener {
private Button button = null;
private Button button2 = null;
private Button button3 = null;
private Button button4 = null; private void initView() {
this.button = (Button) findViewById(R.id.about);
this.button2 = (Button) findViewById(R.id.addr);
this.button3 = (Button) findViewById(R.id.addr_button);
this.button4 = (Button) findViewById(R.id.company);
this.button.setOnClickListener(this);
this.button2.setOnClickListener(this);
this.button3.setOnClickListener(this);
this.button4.setOnClickListener(this);
} @Override
public void onClick(View view) {
if (view == button) {
System.out.println(button.getText());
} else if (view == button2) {
System.out.println(button2.getText());
} else if (view == button3) {
System.out.println(button3.getText());
} else if (view == button4) {
System.out.println(button4.getText());
}
}}
是不是你想要的 你看看!!!!!