1. Are you ready for the Galaxy S20? Here is everything we know so far!

Why my items are not redrawn after invoking `invalidateViews()` ?

Discussion in 'Android Development' started by elad2109, Jun 27, 2013.

  1. elad2109

    elad2109 Lurker
    Thread Starter

    Why my items are not redrawn after invoking `invalidateViews()` ?

    I ask because i try to refresh `listItems` after a bg-thread notify an image rsc was downloaded.

    But nothing is updated. Only after exiting and re-entering the new icons are drawn.

    I have an activity with `adapter` of type `SettingValueAdapter extends BaseAdapter`

    it has a member:

    `private SettingsValue[] values;`

    it has two interesting methods:

    public View getView(int position, View view, ViewGroup parent) {

    AddressItem ai= (AddressItem)getItem(position);
    DriveToNativeManager dnm = DriveToNativeManager.getInstance();

    if (view == null) {
    LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    view = li.inflate(R.layout.address_item, null);


    if (ai != null) {
    Drawable icon = ResManager.GetSkinDrawable(ai.getIcon() + ".bin");


    I attach a callback to the bg-thread (c language) image downloading process.

    The callback switches to the ui-thread and calls this `refreshList`:

    public void refreshSearchIconsOnSearchActivity() {

    Runnable refreshViewEvent = new Runnable() {
    public void run() {
    Activity currentActivity = AppService.getActiveActivity();

    if (currentActivity instanceof SearchActivity) {

    Log.d("w", "refreshSearchIconsOnSearchActivity callback running in thread "
    + Thread.currentThread().getId() );
    //results list
    ((SearchActivity) currentActivity).refreshList();


    However, the images are done downloading and are not refreshed on the activity.

    They are refreshed only when I leave an re-enter the activity.

    What am I missing?

    1. Download the Forums for Android™ app!



Share This Page