title: Constantly update function's parameters
body: <p>I need some help adjusting a function to be constantly updating (&lt;- that may not make sense at first but hopefully a little more explanation will make it clear).  <strong>This is going to be a long post but please bear with me.</strong></p>
  
  <p>I've got an <strong>Activity</strong> and a <strong>Custom Class</strong>.  The <strong>Activity's</strong> Java file only contains a reference to the <code>seekbar</code> that's in it and the <code>OnSeekBarChangeListener</code>.  The XML contains said seekbar, and a reference? to the <strong>Custom Class</strong> (not sure if it's actually called a reference).  Here's the code for both:</p>
  
  <p>Java:</p>
  
  <pre><code>public class Painting extends Activity
  {
      static SeekBar curveBar;
      SampleView sampleView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_painting);
  
          curveBar = (SeekBar)findViewById(R.id.curveBar);
          sampleView = new SampleView(this);
  
          curveBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
              @Override
              public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                  if (progress &gt;= 50
                  {
                      sampleView.updatePath(progress);
                  }
                  else if (progress &lt; 50)
                  {
                      sampleView.updatePath((-1) * progress);
                  }
              }
  
              @Override
              public void onStartTrackingTouch(SeekBar seekBar) {}
  
              @Override
              public void onStopTrackingTouch(SeekBar seekBar) {
                  Toast.makeText(Painting.this, "Value: " + curveBar.getProgress(), Toast.LENGTH_SHORT).show();
              }
          });
      }
  }
  </code></pre>
  
  <p>XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
      tools:context="com.example.android.postvu.SampleView"&gt;
  
      &lt;com.example.android.postvu.SampleView
          android:id="@+id/view"
          android:layout_height="300dp"
          android:layout_width="match_parent"/&gt;
  
      &lt;SeekBar
          android:id="@+id/curveBar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_below="@id/view"
          android:layout_alignParentBottom="true"
          android:layout_marginStart="40dp"
          android:layout_marginEnd="40dp"
          android:elevation="50dp"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/DDLX9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DDLX9.png" alt="enter image description here"></a></p>
  
  <p>My <strong>Custom Class</strong> is what actually draws the canvas with the curve on the top half.  In this class I've got 2 constructors:</p>
  
  <pre><code>public SampleView(Context context, AttributeSet attrs)
      {
          super(context, attrs);
          setFocusable(true);
  
          mPaint = new Paint();
          mPaint.setAntiAlias(true);
          mPaint.setTextSize(90);
          mPaint.setTypeface(Typeface.SERIF);
  
          mPath = new Path();
          makePath(mPath);
  
          mPathPaint = new Paint();
          mPathPaint.setAntiAlias(true);
          mPathPaint.setColor(Color.rgb(255,0,0));
          mPathPaint.setStyle(Paint.Style.STROKE);
      }
  
      public SampleView(Context context)
      {
          super(context);
          setFocusable(true);
  
          mPaint = new Paint();
          mPaint.setAntiAlias(true);
          mPaint.setTextSize(90);
          mPaint.setTypeface(Typeface.SERIF);
  
          Log.d("LOGCAT", "" + value);
  
          mPath = new Path();
          makePath(mPath);
  
          mPathPaint = new Paint();
          mPathPaint.setAntiAlias(true);
          mPathPaint.setColor(Color.rgb(255,0,0));
          mPathPaint.setStyle(Paint.Style.STROKE);
    }    
  </code></pre>
  
  <p><strong>AND FINALLY</strong> the 2 functions that I'm stuck on.  The first is simply being called from the <code>seekbar</code> in the <strong>Activity</strong> and it's just so that I can get the value of the seekbar at all times while it's being moved.</p>
  
  <pre><code>public void updatePath(int seekbarProgress)
  {
      value = seekbarProgress * 6;
  }
  </code></pre>
  
  <p>The second function is what draws the curve itself based on a Bezier Curve:</p>
  
  <pre><code>public void makePath(Path p)
      {
  //            p.moveTo(250, -300);
          p.moveTo(0,0);
  //            p.cubicTo(-250, -550, 750, -550, 250, -300);
  
              p.cubicTo(0,-400,600,-400,600,0); //semi-circle?
  //            p.cubicTo(-600, -400, 600, -400, 0, 0); //as far as the curve probably should allow
  //        p.cubicTo(0, 0, 0, 0, 620,0); //flat line
      }
  </code></pre>
  
  <p><b>MY ACTUAL QUESTION</b></p>
  
  <p>How can I change the <code>makePath</code> function to take the value variable from the <code>updatePath</code> function so that I can make the <code>p.cubicTo</code> look like <code>p.cubicTo(0,-400,600,-400,value,0)</code> considering that I'm calling <code>makePath</code> in both of the constructors? </p>
  
  <h1>****EDIT****</h1>
  
  <p>The 2 constructors from my <strong>Custom Class</strong> (and relevant function) now look like this:</p>
  
  <pre><code>public SampleView(Context context, AttributeSet attrs)
  {
      super(context, attrs);
      setFocusable(true);
  
      mPaint = new Paint();
      mPaint.setAntiAlias(true);
      mPaint.setTextSize(90);
      mPaint.setTypeface(Typeface.SERIF);
  
      mPath = new Path();
  //  updatePath(value);
      makePath(mPath, value);
  
      mPathPaint = new Paint();
      mPathPaint.setAntiAlias(true);
      mPathPaint.setColor(Color.rgb(255,0,0));
      mPathPaint.setStyle(Paint.Style.STROKE);
  }
  
  
  public SampleView(Context context)
  {
      super(context);
      setFocusable(true);
  
      mPaint = new Paint();
      mPaint.setAntiAlias(true);
      mPaint.setTextSize(90);
      mPaint.setTypeface(Typeface.SERIF);
  
      mPath = new Path();
  //  updatePath(value);
      makePath(mPath, value);
      Log.d("LOGTAG2", "" + value);
  
      mPathPaint = new Paint();
      mPathPaint.setAntiAlias(true);
      mPathPaint.setColor(Color.rgb(255,0,0));
      mPathPaint.setStyle(Paint.Style.STROKE);
  }
  
  public int updatePath(int seekbarProgress)
  {
      return value = seekbarProgress * 6;
  }
  
  public void makePath(Path p, int number)
  {
      p.moveTo(0,0);
      p.cubicTo(0, 0, 0, 0, number,0); //flat line
  }
  </code></pre>
  
  <p>Android Studio is highlighting <code>updatePath</code> and when I hover over it, it tells me <code>Return value of the method is never used</code>.  Unless I'm doing something wrong, I <strong>am</strong> using that value in <strong>both</strong> constructors where it says <code>makePath(mPath, value);</code>.  I'm not sure what else to do at this point because it doesn't make any sense to me.  I really want to know 1) how to fix it and 2) what's causing it (why it's telling me that I am not using it (which I think I am)).</p>