Note that there are some explanatory texts on larger screens.

plurals
  1. POcustom checkbox difficulty in android
    primarykey
    data
    text
    <p>how to modify this imageCheckBoxAdapter code in order to maintain status of checkBox when scrolled(that is all the checkboxes which are checked should remain checked even after scrolling. Also the checked variables need to be stored in an array)?</p> <pre><code>class imageCheckBoxAdapter extends ArrayAdapter&lt;String&gt; { private final Context context; private final ArrayList&lt;String&gt; values; private final Map&lt; String, SmbFile&gt; obj; static ArrayList&lt;Boolean&gt; checks=new ArrayList&lt;Boolean&gt;(); public imageCheckBoxAdapter(Context context,ArrayList&lt;String&gt; values,Map&lt; String, SmbFile&gt;obj) { super(context, R.layout.row_checkbox, values); this.context = context; this.values = values; this.obj=obj; } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.row_checkbox, parent, false); TextView textView = (TextView) rowView.findViewById(R.id.text1_check); textView.setText(values.get(position)); ImageView imageView = (ImageView) rowView.findViewById(R.id.icon_image_check); try { if((obj.get(values.get(position)).isFile())) { imageView.setImageResource(R.drawable.view_file_icon); } else { imageView.setImageResource(R.drawable.view_folder_icon); } } catch (SmbException e) { Toast.makeText(context,"Network error",Toast.LENGTH_SHORT).show(); Log.d("id1", "error1"); e.printStackTrace(); } return rowView; } } </code></pre> <p>row_checkbox.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="5dp" &gt; &lt;CheckBox android:id="@+id/checkBox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="false" /&gt; &lt;ImageView android:id="@+id/icon_image_check" android:layout_width="50px" android:layout_height="50px" android:layout_marginLeft="5px" android:layout_marginRight="20px" android:layout_marginTop="5px" android:src="@drawable/view_file_icon" &gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/text1_check" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@+id/label" android:textSize="30px" android:typeface="sans"&gt; &lt;/TextView&gt; &lt;/LinearLayout&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.
    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