我要带我的设备屏幕的快照快照上的按钮点击。请提供一些链接code样品代替。
I want to take snapshot of my device screen's snapshot on Button click. Please provide some code sample instead of links.
在此先感谢。
我得到了我的问题的答案。 Actualy我得到位为空。但我找到了原因和解决方案。
I got the answer for my question. Actualy i am getting bitmap as null. but i found the reason and the solution.
View v = findViewById(R.id.attachments_list);
v.setDrawingCacheEnabled(true);
// this is the important code :)
// Without it the view will have a dimension of 0,0 and the bitmap will
// be null
v.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());
v.buildDrawingCache(true);
Bitmap bitmap = Bitmap.createBitmap(v.getDrawingCache());