Viewpager inside has several fragments. How to capture all fragments efficiently and get images?

  android, question

Android development, viewpager has several fragments, how to efficiently capture all fragments and get all images

mPager.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {

@Override
 public boolean onPreDraw() {
 mPager.getViewTreeObserver().removeOnPreDrawListener(this);
 mPager.buildDrawingCache();
 scrollChangeView.setBackBitmap(mPager.getDrawingCache());
 return true;
 bracket
 });
 mPager.invalidate();
 
 
 This is how I got the screenshots. This is the screenshot of the page displayed by the current viewpager. If you want to get screenshots of different children, you can write it like this: Mpager. GetChild. GetViewTreeobserver () ... It is estimated that you will encounter problems when using it specifically.