本文整理匯總了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();
}