title: Getter returning null in different class
body: <p>while making an Android app, I have ran in the following problem:</p>
  
  <p>My MainActivity looks like this:</p>
  
  <pre><code>...
  private String token;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
  ...
  tokenSetter();
  }
  private void tokenSetter() {
      FirebaseInstanceId.getInstance().getInstanceId()
              .addOnCompleteListener(task -&gt; {
                  if (!task.isSuccessful()) {
                      Log.w("TRAZENITOKEN", "getInstanceId failed", task.getException());
                      return;
                  }
  
                  // Get new Instance ID token
                  String token = Objects.requireNonNull(task.getResult()).getToken();
                  setToken(token);
  
                  Log.d("TRAZENITOKEN", "onGetToken: " + token);
  
                  // Log and toast
                  // Log.d("TRAZENITOKEN", "onComplete: " + token);
              });
  }
  public String getToken() {
      return token;
  }
  
  public void setToken(String token) {
      this.token = token;
  }
  </code></pre>
  
  <p>I know that the token value is being set as in an another method inside this MainActivity class, when I call getToken(), I get the value.</p>
  
  <p>However, when I try to call getToken from an another Activity, something like this:</p>
  
  <pre><code>...
  button.setOnClickListener(view -&gt; {
          FirebaseActions firebaseActions = new FirebaseActions();
          MainActivity  mainActivity = new MainActivity();
          //firebaseActions.setUserNameOnToken(editText.getText().toString());
          if(mainActivity.getToken() != null) editText.setText(mainActivity.getToken());
          else editText.setText("Skafiskafnjak");
      });
  </code></pre>
  
  <p>(I opted for the editText.setText method for debugging purposes, I am going to use it in the commented way)
  The code snippet above always goes to the else part as the getToken is null.
  Why does it return null in this class, if it returns a value in it's own class?
  Could it be perhaps because I did
              MainActivity  mainActivity = new MainActivity();</p>
  
  <p>An answer would be appreciated.
  Thanks in advance!</p>