Update UI during print screen process

1

I have Activity and several Fragments in it, and in Fragment , I have a list of images.

I want a floating button to print all the images without having to change the image on the screen.

I made the code below but it updates the screen image only after taking the photos, so it takes repeated pictures (if the list has 6 pictures it takes 2 pictures of the first 3).

I'd like to know how to update the list to get print out of all the images at once.

@OnClick(R.id.fab_client_screenshot)

public void printScreen() {
Handler handler = new Handler();
handler.post(new Runnable() {
       @Override
       public void run() {
           ListView list = JListaImagens.getInstance().getList();
           list.setSelection(0);
           int j = 0;
           while (j < list.getCount()) {
               int lastPosition = list.getLastVisiblePosition();
               try {
                  for (int i = 0; i < list.getLastVisiblePosition(); i++) {
                     if (list.getChildAt(i).isEnabled()) {
                         JUtil.saveScreenShot(list.getChildAt(i), "Imagem" + j + ".png");
                         j++;
                     }
                  }
               list.setSelection(lastPosition);
               Thread.sleep(1500);
               } catch (InterruptedException e) {
                  e.printStackTrace();
               }
            }
        }
    });
}
    
asked by anonymous 27.08.2015 / 14:47

0 answers