title: global variable in app with service: use Application or SharedPreferences class?
body: <p>My App uses one service in the background. To share data between the UI and Service I'm currently using IPC... but I wonder if it's possible to use the Application class or the SharedPreferences class to easily share global variables between the service and the Activities.</p>
  
  <p>I found example code on how to use the Application class to create global variables:
  <a href="http://www.helloandroid.com/tutorials/maintaining-global-application-state" rel="nofollow">http://www.helloandroid.com/tutorials/maintaining-global-application-state</a></p>
  
  <p>Here I found an example to use SharedPreferences:
  <a href="http://marakana.com/forums/android/examples/63.html" rel="nofollow">http://marakana.com/forums/android/examples/63.html</a></p>
  
  <p>which one is better for sharing data between an activity and service ?</p>