Android - Getting the relevant ListView row on CheckBox changed?

One possible way to solve this is to attach some info to the checkbox when binding occurs.

One possible way to solve this is to attach some info to the checkbox when binding occurs. In your Adapter, add (or modify) the bindView override like this to add a tag thatcontains the context information you need: @Override public void bindView( View view, Context context, Cursor cursor){ CheckBox checker = (CheckBox)view. FindViewById(R.id.

Checkbox); checker. SetOnCheckedChangeListener(MyActivity. This); checker.

SetTag(Long. ValueOf(cursor. GetLong(cursor.

GetColumnIndex(BaseColumns. _ID)))); // call super class for default binding super. BindView(view,context,cursor); } (or attach any other value to the checkbox that helps you identify the item, e.g. The propery name or index) Then, in the onCheckedChanged, you can refer to this information to identify the item that was changed: @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Long id = (Long) buttonView.getTag(); if ( id!

=null) Log. D(TAG, "onCheckedChanged id="+id); }.

Thanks! I have actually just worked out exactly the same approach using a Tag on the checkbox last night! (I've gone through the problem and solution, a long with my actual code here automateddeveloper.blogspot.Com/2010/09/…) – rhinds Sep 6 '10 at 13:58.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions