首页 > 其他 > 详细

lockCanvas为NULL的原因

时间:2014-11-25 10:47:14      阅读:282      评论:0      收藏:0      [点我收藏+]

        最近在一个项目中实现视频渲染,用画布的方式,如mcanvas = mSurface.lockCanvas(null);报了java.lang.NullPointerException mCanvas==null,  从而出现播放视频是有声音没画面啊,代码左推敲右推敲,都找不到用法不恰当的地方,在google里搜寻都无法找到解决方法。最后想到来看看它的API说明,从文档中看到有这么描述: Start editing the pixels in the surface. The returned Canvas can be used to draw into the surface‘s bitmap. A null is returned if the surface has not been created or otherwise cannot be edited. You will usually need to implement Callback.surfaceCreated to find out when the Surface is available for use.这么说明当lockCanvas为空不就两种情况要么没创建成功要么在别的程序里正编辑呢,很明显是后面这种情况,最终找到了在我们的底层代码里有使用nativewindown来做显示,所以就游刃而解了。

lockCanvas为NULL的原因

原文:http://blog.csdn.net/acm2008/article/details/41477757

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!