title: Calling an int that gets changed in another class
body: <p>Here's the problem, I have a class (lets say class1) where depending on the button you select int x is changed to a number 1-6. I need to be able to call this int in class 2, but it does not read the new int x value, it only reads the default.</p>
  
  <pre><code>public class class1 extends Activity {
      private view btn1;
      private view btn2;
      //...
      private view btn6;
      public int x = 1;
  
  btn1.setOnClickListener(sbtn1Listener);
  //...
  btn2.setOnClickListener(sbtn2Listener);
  
  private View.OnClickListener sbtn1Listener = new View.OnClickListener() {
      public void onClick(View v) {
          x = 1;
      }
  };
  private View.OnClickListener sbtn2Listener = new View.OnClickListener() {
      public void onClick(View v) {
          x = 2;
      }
  };
  //...
  </code></pre>
  
  <p>So the buttons work fine in that program, there's more to it but I'll just leave it at that for now. Then class2 needs to read the new value.</p>
  
  <pre><code>public class class2 extends BaseObject {
      public int y = 1;
  
      class1 a = new class1();
      a.getx();
  
      y = a;
  
      if (y == 1) {
      }else if (y == 2){
      //...
  </code></pre>
  
  <p>Instead of reading the new x value from class1 it only reads the default set as 1.</p>
  
  <p>Also note that I cannot change the extended part of class2 because BaseObject is neccessary for it to run all it's components.</p>