Android有关surfaceView又一次创建的问题。

近期在做一个Android视频播放器的项目。遇到一个问题,就是锁屏之后。surfaceview就会被销毁掉,然后就会出现各种错误。到csdn论坛去发帖提问,各种所谓的大神都说,解锁屏在又一次创建一个,问他详细怎么做,就没有回复了。后来也尝试手动创建,可是报错说surfaceview必须在mediaPlayer之前创建。

事实上这个问题,根本不用又一次创建!

。!

解锁屏之后。surfaceview就会自己主动又一次创建。所以。仅仅需在又一次创建之后恢复到曾经的状态就能够了。

时间: 2024-08-08 03:20:30

Android有关surfaceView又一次创建的问题。的相关文章

Android视图SurfaceView的实现原理分析

附:Android控件TextView的实现原理分析 来源:http://blog.csdn.net/luoshengyang/article/details/8661317 在Android系统中,有一种特殊的视图,称为SurfaceView,它拥有独立的绘图表面,即它不与其宿主窗口共享同一个绘图表面.由于拥有独立的绘图表面,因此SurfaceView的UI就可以在一个独立的线程中进行绘制.又由于不会占用主线程资源,SurfaceView一方面可以实现复杂而高效的UI,另一方面又不会导致用户输

Android Camera+SurfaceView实现自定义拍照

对Activity强制横屏,保证预览方向正确.使用OrientationEventListener监听设备方向,判断竖拍时,旋转照片后再保存,保证竖拍时预览图片和保存后的图片方向一致. 运行效果:                       代码: TestCameraActivity.java package com.example.testcamera; import java.io.ByteArrayOutputStream; import java.io.FileOutputStream

Android之SurfaceView学习(一)转转

Android之SurfaceView学习(一) 首先我们先来看下官方API对SurfaceView的介绍 SurfaceView的API介绍 Provides a dedicated drawing surface embedded inside of a view hierarchy. You can control the format of this surface and, if you like, its size; the SurfaceView takes care of pla

Android: 利用SurfaceView绘制股票滑动直线解决延迟问题

1.背景介绍 最近项目要绘制股票走势图,并绘制能够跟随手指滑动的指示线(Indicator)来精确查看股票价格和日期.如下图所示: 上图中的那条白色直线就是股票的指示线,用来跟随手指精确确定股票的时间和股票价格.不论是绘制股票图还是绘制指示线,我们首先想到的就是用Android中的自定义View来实现.实践证明,使用View能够很好地实现静态的图片,但是对用动态图像的绘制,往往会出现延迟的现象.就如上图的指示线,实际用View类实现的,跟随手指移动时,指示线就会出现延迟的现象,严重影响了用户体验

Android之SurfaceView学习

首先我们先来看下官方API对SurfaceView的介绍 SurfaceView的API介绍 Provides a dedicated drawing surface embedded inside of a view hierarchy. You can control the format of this surface and, if you like, its size; the SurfaceView takes care of placing the surface at the c

Android之SurfaceView学习(一)

首先我们先来看下官方API对SurfaceView的介绍 SurfaceView的API介绍 Provides a dedicated drawing surface embedded inside of a view hierarchy. You can control the format of this surface and, if you like, its size; the SurfaceView takes care of placing the surface at the c

android中SurfaceView组件使用解析

SurfaceView组件可以实现高效率的绘制二维图或者显示图像,在游戏开发中经常用到.在android中,已经提供了SurfaceView组件.使用时,一般是通过继承的方法实现自定义surfaceView,也可以在MainActivity中通过接口surfaceHolder.callback接口实现,这里介绍通过接口实现surfaceView绘图,当然,绘图可以是静态图(在指定区域只绘制一次),也可以是动态图(指定区域-->绘制-->再循环). SurfaceView组件的使用流程:通过fi

Android之SurfaceView

转载自:http://www.cnblogs.com/xuling/archive/2011/06/06/android.html 首先我们先来看下官方API对SurfaceView的介绍 SurfaceView的API介绍 Provides a dedicated drawing surface embedded inside of a view hierarchy. You can control the format of this surface and, if you like, it

Android之SurfaceView(一)

首先我们先来看下官方API对SurfaceView的介绍 SurfaceView的API介绍 Provides a dedicated drawing surface embedded inside of a view hierarchy. You can control the format of this surface and, if you like, its size; the SurfaceView takes care of placing the surface at the c