在android中我设计了一个带有两个按钮的列表视图,现在我想在一个按钮上设置 onclicklistener 但在不同的类中。所以我写了一个代码
View view1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_installation);
Datalist=(ListView)findViewById(R.id.installationList);
ButtonLayout ViewButton=new ButtonLayout();
ArrayList<HashMap<String, String>> arl = (ArrayList<HashMap<String, String>>) getIntent().getSerializableExtra("hashMap");
SimpleAdapter adapter = new SimpleAdapter(
Installation.this, arl,
R.layout.activity_button_layout, new String[]
{
TAG_Title,TAG_URL
}, new int[] {
R.id.InnerText1,R.id.URL1 });
LayoutInflater layoutInflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Datalist.setAdapter(adapter);
view1 = layoutInflater.inflate(R.layout.activity_button_layout,null);
ViewButton.ClickButton = (ImageButton)view1.findViewById(R.id.ImageButton01);
ViewButton.ClickButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View view) {
Log.i("Edit Button Clicked", "*********");
}
});
但是当我运行我的应用程序然后它被停止时,你能帮助我吗
logcat的