如何暂停SurfaceView线程从Android活动 [英] How To Pause A SurfaceView Thread From An Android Activity

查看:359
本文介绍了如何暂停SurfaceView线程从Android活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照这个教程很详细,并已成功地理解和复制,我从Android SurfaceView需要的功能:

I have followed this tutorial in great detail and have managed to understand and replicate the functions that I need from an Android SurfaceView:

http://obviam.net/index的.php /移动的影像 - 上的屏幕与 - androi /

我需要在比赛中,这将在活动中访问添加一个暂停按钮。我怎么会去从活动暂停,再后来继续线程?

I need to add a "pause" button in the game, which would be accessed from the activity. How would I go about pausing and then later continuing the thread from the activity?

我曾尝试添加一个按钮来测试它,但是从这一点我无法捉摸如何控制从活动的线程。任何帮助将是非常有用的,很多AP preciated。

I have tried adding a button to test it but from that point I can't fathom how to control the thread from the Activity. Any help will be very useful and much appreciated.

感谢您提前

推荐答案

我想出了一个简单的方法来绕过这个问题。

I figured out a simple way to bypass the problem.

我所做的只是得到了暂停按钮来调用在Surfaceview的活动,因此它会暂停的观点。然后,当我关闭该活动线程从上次停止的地方继续。

All I did was got the pause button to call an activity over the Surfaceview and hence it would pause the view. Then when I close that activity the thread continues from where it left off.

这篇关于如何暂停SurfaceView线程从Android活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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