android - java如何在在timer里传递全局变量?
PHP中文网
PHP中文网 2017-04-17 17:18:16
0
1
294

初学者一枚,打算写一个示波器的app,定时器每秒重新画一次图,但是在定时器的任务里引用了一个全局变量的数组,结果里面调用的值全部都是0.请教诸位大神为什么会出现这种情况?该怎么解决

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
Ty80

The tasks within the java timer belong to anonymous inner classes. When an anonymous inner class calls an external variable, it must specify that the variable is final. This is mainly placed when you call this variable, this variable is called and modified by other parts.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!