嗨,我有下一个表格的动态: ListView
----------------------------
[TextView][Button]
----------------------------
我希望能够接收OnClick
Button;我该怎么做:
以下方法没有帮助:
lv = (ListView)findViewById(R.id.listViewmain);
...
lv.setOnItemClickListener(new ListView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Log.i("click on button", "click on button");
Toast.makeText(getBaseContext(), item, Toast.LENGTH_LONG).show();
}
});
这个也无济于事(而且应用程序崩溃了):
Button b = (Button)findViewById(R.id.buttonTest);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
我该怎么做?