Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid adapter getView does not repaint image on scroll and notification event
    primarykey
    data
    text
    <p>Hi I have a list and I am redrawing the image based on the setting on notification. Basically I can't figure out why the image is NOT redrawn. I see in the log that it gets set.</p> <p>Odly I tried to set a textview in the same view and that works fine. What's wrong with the image? can anybody tell me?</p> <p>Thank you in advance!</p> <pre><code> @Override public View getView(int position, View convertView, ViewGroup parent) { //---- if the view is null, create a new one from xml if (convertView == null) { LayoutInflater layoutInflater = _context.getLayoutInflater(); convertView = layoutInflater.inflate(R.drawable.my_item_layout, parent, false); convertView.setBackgroundResource(R.drawable.mybg); } CustomItem item = super.getItem(position); if (item != null) { TextView title = (TextView)convertView.findViewById(R.id.titleTextView); ImageView image1= (ImageView)convertView.findViewById(R.id.image1); title.setText(item.getName()); if (item.getMyNotificationChangedItemState()){ image1.setImageResource(R.drawable.myimagePink); &lt;- this does not get updated title.setTextColor(this._context.getResources().getColor(R.color.main_text_pink)); else { image1.setImageResource(R.drawable.myimageBlue); title.setTextColor(this._context.getResources().getColor(R.color.main_text_blue)); } } </code></pre> <p>So my Blue image &amp; text gets shown when the list gets loaded the first time. Once notification happens I first update to change the one that's currrently PINK to BLUE and then change the one that I need to update from BLUE to PINK depending on previous and current index of the items in the list. The update is done on the activity. I can see the log prints the fact that getMyNotificationChangedItemState() is changed, and the image is being set, but I never see the change in the UI. </p> <p>Why does that work for TEXTVIEW and does not work for IMAGEVIEW?</p>
    singulars
    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