开发者

Android thread class reuse

I have multiple levels each with their own activity and surfaceview. I'm have a difficult time figuring out how I coul开发者_StackOverflow中文版d use just one thread extended class for all the levels without explicitly setting each surfaceview to the thread. In the thread I'm going to have to use a set method to get the surfaceview class and call its onDraw method in the loop, but I want to use this thread again with all the other levels. Can someone help me on this matter?


I recommend creating a separate class for each level and an interface that all levels implement (maybe each level has an onDraw() method). Then, just advance through the levels by switching out the classes (this could be done within that thread). You can use handlers to communicate between threads the UI layer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜