本文整理汇总了Java中android.hardware.display.DisplayManager.createVirtualDisplay方法的典型用法代码示例。如果您正苦于以下问题:Java DisplayManager.createVirtualDisplay方法的具体用法?Java DisplayManager.createVirtualDisplay怎么用?Java DisplayManager.createVirtualDisplay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.hardware.display.DisplayManager
的用法示例。
在下文中一共展示了DisplayManager.createVirtualDisplay方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initVirtualDisplay
import android.hardware.display.DisplayManager; //导入方法依赖的package包/类
/**
* 将录屏服务的内容显示到Image面板上.
*/
private void initVirtualDisplay() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
DisplayManager mDisplayManager = (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
if (mDisplayManager == null) {
L.e(" 获取 播放管理器失败 ... ");
}
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
L.d("当前安卓 版本 " + Build.VERSION.SDK_INT + " 进入到图片展示 ");
mVirtualDisplay = mDisplayManager.createVirtualDisplay("Remote Droid", mScreenWidth,
mScreenHeight, mScreenDensity,
mImageReader.getSurface(),
DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE);
}
} else {
if (mMediaProjection == null) {
L.e("mMediaProjection is null ...");
return;
} else {
mVirtualDisplay = mMediaProjection.createVirtualDisplay("screen-mirror",
mScreenWidth, mScreenHeight, mScreenDensity, DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
mImageReader.getSurface(), null, null);
}
}
}
示例2: initVirtualDisplay
import android.hardware.display.DisplayManager; //导入方法依赖的package包/类
/**
* 将录屏服务的内容显示到Image面板上.
*/
private void initVirtualDisplay() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
DisplayManager mDisplayManager = (DisplayManager) this.getSystemService(Context.DISPLAY_SERVICE);
if (mDisplayManager == null) {
L.e(" 获取 播放管理器失败 ... ");
}
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
L.d("当前安卓 版本 " + Build.VERSION.SDK_INT + " 进入到图片展示 ");
mVirtualDisplay = mDisplayManager.createVirtualDisplay("Remote Droid", mScreenWidth,
mScreenHeight, mScreenDensity,
mImageReader.getSurface(),
DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE);
}
} else {
if (mMediaProjection == null) {
L.e("mMediaProjection is null ...");
return;
} else {
mVirtualDisplay = mMediaProjection.createVirtualDisplay("screen-mirror",
mScreenWidth, mScreenHeight, mScreenDensity, DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
mImageReader.getSurface(), null, null);
}
}
}
示例3: startDisplayManager
import android.hardware.display.DisplayManager; //导入方法依赖的package包/类
@TargetApi(19)
public void startDisplayManager() {
DisplayManager mDisplayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
Surface encoderInputSurface = null;
try {
encoderInputSurface = createDisplaySurface();
} catch (IOException e) {
e.printStackTrace();
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
virtualDisplay = mDisplayManager.createVirtualDisplay("Remote Droid", CodecUtils.WIDTH, CodecUtils.HEIGHT, 50,
encoderInputSurface,
DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE);
} else {
if (MainActivity.mMediaProjection != null) {
virtualDisplay = MainActivity.mMediaProjection.createVirtualDisplay("Remote Droid",
CodecUtils.WIDTH, CodecUtils.HEIGHT, 50,
DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
encoderInputSurface, null, null);
} else {
showToast("Something went wrong. Please restart the app.");
}
}
encoder.start();
}
示例4: startDisplayManager
import android.hardware.display.DisplayManager; //导入方法依赖的package包/类
@TargetApi(19)
public void startDisplayManager() {
DisplayManager mDisplayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
Surface encoderInputSurface = null;
try {
encoderInputSurface = createDisplaySurface();
} catch (IOException e) {
e.printStackTrace();
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
virtualDisplay = mDisplayManager.createVirtualDisplay("Remote Droid",
AccessConstants.PHONE_WIDTH, AccessConstants.PHONE_HEIGHT, 50,
encoderInputSurface,
DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE);
} else {
if (mMediaProjection != null) {
virtualDisplay = mMediaProjection.createVirtualDisplay("Remote Droid",
AccessConstants.PHONE_WIDTH, AccessConstants.PHONE_HEIGHT, AccessConstants.DPI,
DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
encoderInputSurface, null, null);
} else {
Log.e(TAG, "Something went wrong. Please restart the app.");
}
}
// sendData2();
encoder.start();
}