我在 Micromax Canvas HD 上捕捉屏幕截图时面临空指针异常。
在三星Tab2 和三星Note 800 上工作正常。
我使用了以下代码行。
scrollView.setDrawingCacheEnabled(true);
scrollView.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
scrollView.layout(0, 0, scrollView.getMeasuredWidth(), scrollView.getMeasuredHeight());
MailAttachmentImage = Bitmap.createBitmap(scrollView.getDrawingCache()); //Showing Nullpointer exception at this line of code on Canvas HD
scrollView.setVisibility(View.GONE);
scrollView.setDrawingCacheEnabled(false);
scrollView.invalidate();