• 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: 11445
18
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: 42970
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
Boost this thread!