title: How to create a global variable in android?
body: <p>In my android application I need a place for putting the variable member id .
  The problem is , it is getting from the online API and I need to find a way to store / retrieve it </p>
  
  <p>I have tried to put it in a custom class , but the problem is , it will lose if I kill the activity, I have also know that there is a way to extends the application.</p>
  
  <p>So  I would like to know what is the best way to store global variable?</p>
  
  <p>I have to implment:</p>
  
  <ol>
  <li>Save the variable on onSaveState</li>
  <li>Save it on sharepref</li>
  <li>Save it manually</li>
  <li>Retrieve it manually</li>
  </ol>
  
  <p>Thanks</p>
  
  <p><strong>Update:</strong> 
  Thanks for reply. If I have just 3 variable (simple data e.g. a boolean , a phrase ), and I need it after app restart , should I simply use share pref to store it? What is the drawback of it? e.g. Will it harmful to the performance? thanks</p>