运行SurfaceView关闭UI线程 [英] Run SurfaceView off UI Thread

查看:371
本文介绍了运行SurfaceView关闭UI线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我surfraceview就是我的大部分应用的是,我想,以减少其滞后性,因此,有人告诉我把它关闭UI线程。是否有可能在AsyncTask的运行SurfaceView?

My surfraceview is where the majority of my application is and I would like to reduce its lag, thus I have been told to take it off the UI Thread. Is it possible to run a SurfaceView in an AsyncTask?

推荐答案

虽然有可能吸引到来自不建议一个AsyncTask的一个SurfaceView。 AsyncTasks可以在串行队列中运行,所以你可能会阻止其他任务。相反,只使用一个线程。该SDK包含一个名为LunarLander一个示例应用程序展示了如何做到这一点。

While it is possible to draw into a SurfaceView from an AsyncTask it is not recommended. AsyncTasks can run in a serial queue so you would likely block other tasks. Instead just use a Thread. The SDK contains a sample app called LunarLander which shows how to do this.

这篇关于运行SurfaceView关闭UI线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆