title: Unable to call String from OnTimeSetListener
body: <p>I added a TimePicker to my App. The selected time is displayed corecctly in the TextView, but I can't call the String later to send it to the Server.</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      mArrivalTimepicker = new TimePickerDialog.OnTimeSetListener() {
          @Override
          public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
              String ArrivalTimeString = hourOfDay + ":" + minute;
              TextView ArriavalTime = findViewById(R.id.arrival_time_tv);
              ArriavalTime.setText(ArrivalTimeString);
          }
      };
  }
  </code></pre>
  
  <p>When I later try to call it, it says 'cannot resolve Symbol 'ArrivalTimeString'.</p>
  
  <pre><code>public void addMessage() {
      String arrivalTime = ArrivalTimeString;
  }
  </code></pre>
  
  <p>Thanks for helping me out!</p>
  
  <p>Edit:
  I now declared the String global. I can call the String now, but it's Value ist still empty.</p>
  
  <pre><code>String ArrivalTimeString;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
  mArrivalTime = findViewById(R.id.arrival_time_tv);
  
  mArrivalTimepicker = new TimePickerDialog.OnTimeSetListener() {
          @Override
          public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
              ArrivalTimeString = hourOfDay + ":" + minute;
          }
      };
  mArrivalTime.setText(ArrivalTimeString);
  }
  </code></pre>
  
  <p>So after I select a time it still won't display the selected time.</p>
  
  <p>Solution:
  I still call the <code>.setText</code> within the <code>.OnTimeSetListener</code>. To use the String later on, I use </p>
  
  <pre><code>ArrivalTimeString = mArrivalTime.getText().toString();
  </code></pre>