title: Transfer data between listeners
body: <p>I need to transfer <code>leftPinIndex</code> and <code>rightPinIndex</code> variables from one listener to another, when clicking on the button.</p>
  
  <p>How can I do that better than now?</p>
  
  <pre><code>        final int[] a = new int[1];
          final int[] b = new int[1];
  
          rangebar.setOnRangeBarChangeListener(new RangeBar.OnRangeBarChangeListener() {
              @Override
              public void onRangeChangeListener(RangeBar rangeBar,
                                                int leftPinIndex,
                                                int rightPinIndex,
                                                String leftPinValue,
                                                String rightPinValue) {
                  //get leftPinIndex и rightPinIndex
                  a[0] = leftPinIndex;
                  b[0] = rightPinIndex;
              }
  
          resultButton.setOnClickListener(v -&gt; {
              //get variables here from rangebar listener
              Log.i("variables: ", a[0] + " " + b[0]);
          });
  </code></pre>