ListView is not updating, Android

0

Well, I have the code below. I created a FloatingActionButton that takes a picture of all items that are in ListView , but the list.getChildAt (i) .isEnable method is returning nullpointer. Any ideas to solve?

ListView list = JTaritronClientReportFragment.getInstance().getList();

list.setSelection(0);
int j=0;
while (j<list.getCount()) {
    int lastPosition = list.getLastVisiblePosition();
    for (int i = 0; i < list.getLastVisiblePosition() - list.getFirstVisiblePosition(); i++) {
        if (list.getChildAt(i).isEnabled()) {
            JUtil.saveScreenShot(list.getChildAt(i), "operadora" + j + ".png");
            j++;
        }
    }
    list.setSelection(lastPosition);
}
    
asked by anonymous 28.08.2015 / 16:54

1 answer

1

You can use the following method:

    list.invalidateViews(); // Para atualizar a lista

And to update the content if invalidateViews () does not work and you have an Adapter:

    seuAdapter.notifyDataSetChanged(); // Para atualizar o cursor da lista

If these alternatives do not work visit this post, because it looks like your question:

link

I hope I have helped.

Thank you

    
28.08.2015 / 18:43