Reputation: 34477
Hello I have a listview
in which I am using custom adapter & cutom layout of rows. I have like imageview
at the top then bottom of it one checkbox at left end and button on right end.
Now I want to apply checked listener on checkbox
and click listener on button
. Here is this I am doing
mybutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
satView.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (isChecked){
// perform logic
}
}
});
So in a listview there would be checkbox
and buttton
in each row. How would I know user click on second or third etc row checkbox
or button
.
Thanks in advance.
Upvotes: 3
Views: 738
Reputation: 10948
There is some ways to do this. My prefferred method is by adding setOnCheckedChangeListener
to your checkbox's
holder in your custom view class, in getView
method.
You can use position
parameter in the getView
to get the current row position.
Upvotes: 2