Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Cancel
2
  • 1
    And why we should use set and get (Jeff Gilfelt's asnwer)?! Why we just set value directly to variable? like this: public volatile static String x; and to set value : GeneralClass.x = value; Commented Jun 20, 2014 at 12:04
  • 2
    This question is similar to: How to declare global variables in Android?. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. Commented Nov 25, 2025 at 11:44