Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: How come my ListView style gets removed when List Item is scrolled off screen
    primarykey
    data
    text
    <p>Currently, I have a custom list adapter that has some logic that hide/show a certain ImageView in a row depending on a variable.</p> <p>Initially, the logic works when the app first launches. (ImageView is hidden/shown accordingly).</p> <p>But once I scroll the screen up and down, eventually, all the row's ImageView is hidden forever.</p> <p><strong>Does anyone know how to solve this problem?</strong></p> <p>here is my adapter:</p> <pre><code>public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; PostHolder holder = null; if(row == null) { LayoutInflater inflater = ((Activity)context).getLayoutInflater(); row = inflater.inflate(layoutResourceId, parent, false); holder = new PostHolder(); holder.postThumb = (ImageView)row.findViewById(R.id.post_Thumb); holder.postComments = (TextView)row.findViewById(R.id.post_comments); holder.postInfo = (TextView)row.findViewById(R.id.item_subtitle); holder.postScore = (TextView)row.findViewById(R.id.post_score); holder.postTitle = (TextView)row.findViewById(R.id.item_title); holder.postThumbHolder = (LinearLayout)row.findViewById(R.id.post_Thumb_holder); row.setTag(holder); } else { holder = (PostHolder)row.getTag(); } HashMap&lt;String, String&gt; post = data.get(position); if(post.get("thumbnail").equals("default") || post.get("thumbnail").equals("self")){ holder.postThumbHolder.setVisibility(View.GONE); } holder.postComments.setText(post.get("comments")); holder.postInfo.setText(post.get("info")); holder.postScore.setText(post.get("score")); holder.postTitle.setText(post.get("title")); return row; } static class PostHolder { LinearLayout postThumbHolder; ImageView postThumb; TextView postComments; TextView postScore; TextView postTitle; TextView postInfo; } </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.
    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