HDMI×Android

HDMI用の端子のついていて、かつAPI Level17以上の場合、Presentationクラスが使える。

class HogePresentation extends Presentation {
public HogePresentation(Context outerContext, Display display) {
super(outerContext, display);
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hoge);
}
}


//Activity内で
DisplayManager dm = (DisplayManager)getSystemService(Context.DISPLAY_SERVICE);
Display[] displays = dm.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION);
new HogePresentation(this, displays[0]).show();

だいたいこんな感じにすると、Android本体の表示とHDMIで接続した別の画面の表示を変える事ができる。
別の画面をごにょごにょいじりたい時はPresentationを継承したクラスのViewをいじればいい。