• Post Reply Bookmark Topic Watch Topic
  • New Topic

global varible for application

 
sam liya
Ranch Hand
Posts: 1246
  • 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
Bartender
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.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!