Note that there are some explanatory texts on larger screens.

plurals
  1. POToast when checked in custom adapter listview
    primarykey
    data
    text
    <p>I want when I checked on check box the code returns string of text view that's in the same row only.</p> <p>I'm using LayoutInflater and another class which has code for creating list containing strings.</p> <p>My code : </p> <pre><code> public class InteractiveArrayAdapter extends ArrayAdapter&lt;model&gt; { private final List&lt;model&gt; list; private final Activity context; public InteractiveArrayAdapter(Activity context, List&lt;model&gt; list) { super(context, R.layout.rep, list); this.context = context; this.list = list; } static class ViewHolder { protected TextView text; protected CheckBox checkbox; } public View getView(int position, View convertView, ViewGroup parent) { View view = null; if (convertView == null) { LayoutInflater inflator = context.getLayoutInflater(); view = inflator.inflate(R.layout.rep, null); final ViewHolder viewHolder = new ViewHolder(); viewHolder.text = (TextView) view.findViewById(R.id.TextView07); viewHolder.checkbox = (CheckBox) view.findViewById(R.id.CheckBox05); viewHolder.checkbox .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { model element = (model) viewHolder.checkbox .getTag(); element.setSelected(buttonView.isChecked()); } }); view.setTag(viewHolder); viewHolder.checkbox.setTag(list.get(position)); } else { view = convertView; ((ViewHolder) view.getTag()).checkbox.setTag(list.get(position)); } ViewHolder holder = (ViewHolder) view.getTag(); holder.text.setText(list.get(position).getName()); holder.checkbox.setChecked(list.get(position).isSelected()); return view; } } </code></pre> <p>my xml :</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;TableLayout android:id="@+id/h103" android:layout_width="match_parent" android:layout_height="27dp" android:layout_x="0dp" android:layout_y="0dp" android:background="@drawable/back1" &gt; &lt;TableRow android:id="@+id/TableRow05" android:layout_width="match_parent" android:layout_height="27dp" android:layout_marginTop="4dp" &gt; &lt;CheckBox android:id="@+id/CheckBox05" android:layout_width="20dp" android:layout_height="20dp" android:layout_marginLeft="20dp" android:layout_marginTop="-4dp" android:button="@drawable/test" /&gt; &lt;TextView android:id="@+id/TextView07" android:layout_width="220dp" android:layout_height="22dp" android:layout_marginLeft="23dp" android:layout_marginTop="-6dp" android:text="" /&gt; &lt;TextView android:id="@+id/TextView08" android:layout_width="110dp" android:layout_height="22dp" android:layout_marginLeft="0dp" android:layout_marginTop="-4dp" android:text="095110263" /&gt; &lt;/TableRow&gt; &lt;/TableLayout&gt; &lt;/AbsoluteLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload