我今天找了一天没找到啊!网上方法都试过了。。
public Bitmap getScreenshot(){
if(input!=null) {
try {
int size = input.readInt();
byte[] data = new byte[size];
int len = 0;
while (len < size) {
len += input.read(data, len, size - len);
}
ByteArrayOutputStream outPut = new ByteArrayOutputStream();
bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
bmp.compress(Bitmap.CompressFormat.PNG, 100, outPut);
Log.d("截图", "getScreenshot: ");
return bmp;
} catch (IOException e) {
Log.e("截图", "getScreenshot: " + e.toString(), e);
return null;
}
}
return null;
}
Log.d("截图", "getScreenshot: ");这句怎么也执行不到。。