I have a list view with a custom adapter. the layout for the adapter has some ImageViews which act as buttons. I implemented the onclicklistner for these
listView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1,int arg2, long arg3) {
ImageView btn = (ImageView) arg1.findViewById(R.id.btn);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// for the button action
Log.d("Button Action", "Clicked");
}
});
}
}
when i click the button first time it does not do any thing .i have to click twice to get the button work. Why is this. can any one point me my mistake
thanks in advance