android hdmi开关,Android – 禁用HDMI

最好的方法是使用与DisplayID相关的命令集,允许您监听要添加,更改或删除的显示.

这是一个快速的例子,它是如何改变你的显示/ HDMI:

private final DisplayManager.DisplayListener mDisplayListener =

new DisplayManager.DisplayListener() {

@Override

public void onDisplayAdded(int displayId) {

Log.d(TAG, "Display #" + displayId + " added.");

mDisplayListAdapter.updateContents();

}

@Override

public void onDisplayChanged(int displayId) {

Log.d(TAG, "Display #" + displayId + " changed.");

mDisplayListAdapter.updateContents();

}

@Override

public void onDisplayRemoved(int displayId) {

Log.d(TAG, "Display #" + displayId + " removed.");

mDisplayListAdapter.updateContents();

}

};

此处如何让您的所有HDMI /显示设备可用于连接:

protected void onResume() {

// Be sure to call the super class.

super.onResume();

// Update our list of displays on resume.

mDisplayListAdapter.updateContents();

// Restore presentations from before the activity was paused.

final int numDisplays = mDisplayListAdapter.getCount();

for (int i = 0; i < numDisplays; i++) {

final Display display = mDisplayListAdapter.getItem(i);

final PresentationContents contents =

mSavedPresentationContents.get(display.getDisplayId());

if (contents != null) {

showPresentation(display, contents);

}

}

mSavedPresentationContents.clear();

// Register to receive events from the display manager.

mDisplayManager.registerDisplayListener(mDisplayListener, null);

}

//unregisterDisplayListener(DisplayManager.DisplayListener);

@Override

protected void onPause() {

// Be sure to call the super class.

super.onPause();

// Unregister from the display manager.

mDisplayManager.unregisterDisplayListener(mDisplayListener);

// Dismiss all of our presentations but remember their contents.

Log.d(TAG, "Activity is being paused. Dismissing all active presentation.");

for (int i = 0; i < mActivePresentations.size(); i++) {

DemoPresentation presentation = mActivePresentations.valueAt(i);

int displayId = mActivePresentations.keyAt(i);

mSavedPresentationContents.put(displayId, presentation.mContents);

presentation.dismiss();

}

mActivePresentations.clear();

}

关于“无效”HDMI输出,如果最终发生,只需重画.这应该解决任何“invalidate”,万一发生.

您可能会发现有用的进一步检查documentation.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值