开发者

android: public static variables being reset across same package in different classes in the framework

I'm trying to keep track of home key button hit and touch event in the area of interest pressed within some fixed window of time. For that I'm using public static int COUNTER_HOME =0 in View.java under frameworks/base/ core/java/android/view/

I then increment the variable in WindowManagerService.java under frameworks/base/services/java/com/android/server/ View.COUNTER_HOME++ when i acess the variable upon touch event in ViewGroup.java which is a subclass of View under frameworks/base/core/java/android/view I see the COUNTER to be 0, WHy is that, is the class ViewG开发者_运维知识库roup reloaded everytime the control transfers from WindowManagerService, I dont understand it or there is something I'm missing?

Appreciate your help


It does not become clear from your description if you set and read the variable from the same process. As every process has its own heap, they also have their own, independent copies of the variable.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜