SurfaceHolder.Callback

Class Overview



A client may implement this interface to receive information about changes to the surface. When used with a SurfaceView, the Surface being held is only available between calls to surfaceCreated(SurfaceHolder) andsurfaceDestroyed(SurfaceHolder). The Callback is set with SurfaceHolder.addCallback method.

Public Methods


public abstract void surfaceChanged (SurfaceHolder holder, int format, int width, int height)

Added in API level 1

This is called immediately after any structural changes (format or size) have been made to the surface. You should at this point update the imagery in the surface. This method is always called at least once, aftersurfaceCreated(SurfaceHolder).

Parameters
holder The SurfaceHolder whose surface has changed.
format The new PixelFormat of the surface.
width The new width of the surface.
height The new height of the surface.

public abstract void surfaceCreated (SurfaceHolder holder)

Added in API level 1

This is called immediately after the surface is first created. Implementations of this should start up whatever rendering code they desire. Note that only one thread can ever draw into a Surface, so you should not draw into the Surface here if your normal rendering will be in another thread.

Parameters
holder The SurfaceHolder whose surface is being created.

public abstract void surfaceDestroyed (SurfaceHolder holder)

Added in API level 1

This is called immediately before a surface is being destroyed. After returning from this call, you should no longer try to access this surface. If you have a rendering thread that directly accesses the surface, you must ensure that thread is no longer touching the Surface before returning from this function.

Parameters
holder The SurfaceHolder whose surface is being destroyed.
时间: 08-18

SurfaceHolder.Callback的相关文章

Surface、SurfaceView、SurfaceHolder及SurfaceHolder.Callback之间的关系

一.Surface Surface就是“表面”的意思.在SDK的文档中,对Surface的描述是这样的:“Handle onto a raw buffer that is being managed by the screen compositor”,翻译成中文就是“由屏幕显示内容合成器(screen compositor)所管理的原生缓冲器的句柄”,这句话包括下面两个意思: 1.      通过Surface(因为Surface是句柄)就可以获得原生缓冲器以及其中的内容.就像在C语言中,可以通

Android图形系统之Surface、SurfaceView、SurfaceHolder及SurfaceHolder.Callback之间的联系

1.Surface Surfaceextends Objectimplements Parcelable java.lang.Object    ? Android.view.Surface Class Overview -------------------------------------------------------------------------------- Handle onto a raw buffer that is being managed by the scre

android大扫盲之SurfaceView,SurfaceHolder,SurfaceHolder.CallBack

最近接触到了SurfaceView,SurfaceHolder,SurfaceHolder.CallBack,一直不求其解,现在来粗浅认识一下它们. 先看一下官方的定义: 1.SurfaceView SurfaceView是视图(View)的继承类,这个视图里内嵌了一个专门用于绘制的Surface.你可以控制这个Surface的格式和尺寸.Surfaceview控制这个Surface的绘制位置.surface是纵深排序(Z-ordered)的,这表明它总在自己所在窗口的后面.surfacevie

Android之——Surface、SurfaceView与SurfaceHolder.Callback初探

转载请注明出处:http://blog.csdn.net/l1028386804/article/details/47167553 一.Surface    Surface在SDK的文档中的描述是这样的:Handle onto a raw buffer that is being managed by the screen compositor,Android中的Surface就是一个用来画图形(graphics)或图像(image)的地方,对于View及其子类,都是画在Surface上,各Su

自己定义控件(2.2):SurfaceView和SurfaceHolder

本例需求及流程: Activity载入自己定义的SurfaceView-> SurfaceView 构造器中启动线程A.循环改变SurfaceView的x,y坐标,当x,y坐标到某点时设渐显标志位picAlphaFlag为true -> Surface创建时即surfaceCreated中,启动线程B,循环依据SurfaceView的x,y(被线程A循环改变)实时绘制图的位置,而且picAlphaFlag为true时,渐显还有一张图. 本例可优化点(个人意见): 1.线程A和线程B可合并: 本

自定义控件(2.2):SurfaceView和SurfaceHolder

本例需求及流程: Activity加载自定义的SurfaceView-> SurfaceView 构造器中启动线程A,循环改变SurfaceView的x,y坐标,当x,y坐标到某点时设渐显标志位picAlphaFlag为true -> Surface创建时即surfaceCreated中,启动线程B,循环根据SurfaceView的x,y(被线程A循环改变)实时绘制图的位置,并且picAlphaFlag为true时,渐显另一张图. 本例可优化点(个人意见): 1.线程A和线程B可合并: 本例启

Android笔记:SurfaceView与SurfaceHolder对象

摘要 调试Media播放时,不时用到SurfaceView与SurfaceHolder对象,写case测试及实际运行效果, 基本上搞清楚这两个对象的用法及区别 1.SurfaceView public class SurfaceView extends View SurfaceView是视图(View)的继承类, 这个视图里内嵌了一个专门用于绘制 调试Media播放时,不时用到SurfaceView与SurfaceHolder对象,写case测试及实际运行效果, 基本上搞清楚这两个对象的用法及区

SurfaceView和SurfaceHolder的基本用法

仅做记录使用,新手也可以来看看,怎么得到一个surfaceholder. 1.在xml文件中增加一个surfaceView控件. <SurfaceView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/surfaceView" android:layout_alignParentTop="true&q

Android开发之播放器中涉及的Surface,SurfaceView,SurfaceHolder基础

一.什么是Surface 简单的说Surface对应了一块屏幕缓冲区,每个window对应一个Surface,任何View都要画在Surface的Canvas上(后面有原因解释).传统的view共享一块屏幕缓冲区,所有的绘制必须在UI线程中进行. 在SDK的文档中,对Surface的描述是这样的:"Handle onto a raw buffer that is being managed by the screen compositor",翻译成中文就是"由屏幕显示内容合成