Reputation: 1
I have a listView
that has 3 textViews
fields and a check box
in ever row.<br
>
If a particular checkBox
is selected or checked then how to access the details in that row (or the values of the corresponding textViews
) corresponding to the checked check box
?
Upvotes: 0
Views: 1739
Reputation: 1527
This solution is worked for me.
In Your View getView() under the BaseAdapter class add below code.
public static boolean checked=false;
holder.your_checkBox.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
CheckBox cb = (CheckBox) v;
if(cb.isChecked())
{
checked=true;
String selected_txt = object_of_ArrayList.get(position).get(ArrayList.Value);
// For Example//
String name=friendList.get(position).get(FriendList.FRIEND_NAME);
}
}
});
If you want use this item text in another activity then you want make string as static like that
public static String name;
If you want access this name in another activity
String str_name=your_adapterName.string;
Upvotes: 1