title: How to use global class variables in android
body: <p>Hi I am doing one app here. I'm using global class varibles. It's working well, but if I'm using more globalclass variables  I'm getting memory exceptions some times. </p>
  
  <p>I tried this:</p>
  
  <pre><code>  public class SecondClass extends Activity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.second);
  
  
  
      TextView tv = (TextView)findViewById(R.id.tv);
      tv.setText("Global String : " + GlobalClass.myVal);
  }
   }
  
  
    class GlobalClass extends Application {
  
     static String myVal;
  
    }
  </code></pre>
  
  <p>Is this correct or not?</p>