This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

global varible for application

 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need a global varible for my android application.is there a good way to do this ?
I have several activities.I need to use this variable for all these activities.
 
Maneesh Godbole
Saloon Keeper
Posts: 11341
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Define it in your strings.xml and access it via context.getString(int id)
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alternatively, if the value can change at runtime, extend Application.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic