我越來越黑屏不是視頻內容請幫助我。如何在android中播放視頻時拍攝videoview的快照?
我的代碼:
private Bitmap takeScreenshot() {
relate.setDrawingCacheEnabled(true);
relate.buildDrawingCache();
return relate.getDrawingCache();
}
private void saveBitmap(Bitmap bitmap) {
// File imagePath = new File(Environment.getExternalStorageDirectory() + "/screenshot.png");
FileOutputStream fos;
// String path ="data/data/com.focusmedica.eyeactivity/files/Images" + filename;
try {
fos =new FileOutputStream(path);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
sentmail(path);
} catch (FileNotFoundException e) {
Log.e("GREC", e.getMessage(), e);
} catch (IOException e) {
Log.e("GREC", e.getMessage(), e);
}
}
我使用canvas
對videoview
繪製的東西。而我只得到黑屏。 my videoview
在relative layout
之內。 感謝提前.....
你使用的是surfaceview還是textureview? – GvSharma
不,我沒有使用這兩個,其實我是新的android所以我不知道這件事情... @ gvsharma –