我的思路是在主屏中开启activity,然后在副屏中开启服务,通过服务我们就可以让副屏一直显示或者播放节目或者打开其他应用,哪怕是退主屏退出activity。
   // 获取显示设备。    public void updateContents() {        mDisplayManager = (DisplayManager) getSystemService(                Context.DISPLAY_SERVICE);        Display[] displays = mDisplayManager.getDisplays();        showPresentation(displays[1]);    }
// 将内容显示到display上面。private void showPresentation(Display display) {    myPresentation = new MyPresentation(this, display);    myPresentation.setOnDismissListener(new DialogInterface.OnDismissListener() {        @Override        public void onDismiss(DialogInterface dialog) {            // 监听消失,保存当前播放位置。            sharedPreferences.edit().putInt("index", nowHdmiPosition).commit();            sharedPreferences.edit().putInt("position", mBackgroundPlayer.getCurrentPosition()).commit();        }    });    myPresentation.getWindow().setType(WindowManager.LayoutParams.TYPE_PHONE);    myPresentation.show();    presentSurface = myPresentation.getSurface();    presentSurface.getHolder().addCallback(new MySurfaceCallback());}

源码下载链接:
http://download.csdn.net/detail/bestchenq/9561946

更多相关文章

  1. android singleTask使用情况,场景分析
  2. android 标题栏不显示?
  3. android 虚拟机网络问题处理
  4. Android(安卓)Window理解(3.1)---子窗口创建过程:Dialog、PopupWind
  5. android 视频播放 JiaoZiVideoPlayer使用分析
  6. TextView 文本过长时自动打点
  7. Android的震动与振铃
  8. Android(安卓)Fragment学习笔记(二)
  9. android关于popupWindow不显示

随机推荐

  1. android 更换皮肤的实现
  2. Android中的网络应用之网页设置,检测、配
  3. Android性能优化之三级缓存
  4. android输入字符限制
  5. Android(安卓)RecyclerView瀑布流布局添
  6. Warning:Default Activity not found And
  7. 备战面试旺季:三年开发经验,离开了某创业公
  8. Android的进程管理 -奇怪且创新的进程哲
  9. android 字体样式
  10. Android社交系统----代码结构