title: Get value from another class
body: <p>I want to get value from another class, but when I get it in second class it is null. I think it is caused bcs when is something added to this String that code does not run.</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_maps);
      // Obtain the SupportMapFragment and get notified when the map is ready to be used.
      SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
              .findFragmentById(R.id.map);
      mapFragment.getMapAsync(this);
  </code></pre>
  
  <p>a lot of not important code.......................................</p>
  
  <pre><code>FirebaseDatabase database5 = FirebaseDatabase.getInstance();
      DatabaseReference myRef5 = database5.getReference("userdata");
  
      myRef5.addValueEventListener(new ValueEventListener() {
          @Override
          public void onDataChange(DataSnapshot dataSnapshot) {
              // This method is called once with the initial value and again
              // whenever data at this location is updated.
  </code></pre>
  
  <p>lot of not improtant code.............................................</p>
  
  <pre><code>mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
                      @Override
                      public boolean onMarkerClick(final Marker marker) {
  </code></pre>
  
  <p>a lot of not important code...........................................</p>
  
  <pre><code>new CountDownTimer(2000, 1000) {
  
             public void onTick(long millisUntilFinished) {
  
             }
             public void onFinish() {
  
                 progressBar.setVisibility(View.GONE);
                 textViewPleaseWait.setVisibility(View.INVISIBLE);
  
                 recipientEmail = marker.getTitle();
                 Log.i("omg", recipientEmail);
  
                 dialogBuilder.setMessage("Username: " + usernameAlert + "\n" + "Gender: " + genderAlert
                                         + "\n" + "Age: " + ageAlert + "\n" + marker.getSnippet() + "\n" + marker.getTitle());
  
                 dialogBuilder.setPositiveButton("Send message", new DialogInterface.OnClickListener() {
                     public void onClick(DialogInterface arg0, int arg1) {
                         Intent intent = new Intent(getApplicationContext(), SendMessage.class);
                         startActivity(intent);
  
                         recipientEmail = marker.getTitle();
                     }
                 });
  
                 dialogBuilder.setNegativeButton("Close", null);
                 dialogBuilder.show();
  
  
             }
         }.start();
  </code></pre>
  
  <p>}</p>
  
  <p>And here it is.... I set value to recipientEmail when timer is done but I must run timer by clicking on marker on map. I can't set value recipientEmail outside of this timer bcs value wouldn't be same. So when I call it in another class, normally:</p>
  
  <pre><code>MapsActivity mapsActivity = new MapsActivity();
  
      recipientUsername2 = mapsActivity.getRecipientEmail();
      Log.i("values2", mapsActivity.recipientEmail);
  </code></pre>
  
  <p>And after running second activity app crashes.</p>
  
  <pre><code>08-28 21:34:25.943 4609-4609/com.samo.facedatefb E/AndroidRuntime: FATAL EXCEPTION: main
  Process: com.samo.facedatefb, PID: 4609
  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.samo.facedatefb/com.samo.facedatefb.SendMessage}: java.lang.NullPointerException: println needs a message
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2464)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2526)
      at android.app.ActivityThread.access$800(ActivityThread.java:169)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
      at android.os.Handler.dispatchMessage(Handler.java:111)
      at android.os.Looper.loop(Looper.java:194)
      at android.app.ActivityThread.main(ActivityThread.java:5549)
      at java.lang.reflect.Method.invoke(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:372)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)
   Caused by: java.lang.NullPointerException: println needs a message
      at android.util.Log.println_native(Native Method)
      at android.util.Log.i(Log.java:160)
      at com.samo.facedatefb.SendMessage.onCreate(SendMessage.java:79)
      at android.app.Activity.performCreate(Activity.java:5975)
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2526) 
      at android.app.ActivityThread.access$800(ActivityThread.java:169) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421) 
      at android.os.Handler.dispatchMessage(Handler.java:111) 
      at android.os.Looper.loop(Looper.java:194) 
      at android.app.ActivityThread.main(ActivityThread.java:5549) 
      at java.lang.reflect.Method.invoke(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:372) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759) 
  </code></pre>
  
  <p>Could you help me please?</p>