title: How to draw sine wave curve using sin() function and canvas in android?
body: <p>I am new to android and I am trying to draw a sine wave on the screen on the trigger of accelerometer  values change. I just need a plain sine wave dynamically drawn on the screen(confined to screen). I can draw the coordinates on Canvas and validate screen dimensions but I am not able to think of how to convert sine values(ranging from 0 to 1) to the screen coordinates.</p>
  
  <p>I was trying something like this in onSensorChanged():</p>
  
  <pre><code>tvarY = sin(tvarX)*2.0;  // tvarX and tvarY are double values
  tvarX= (tvarX+ 2);        // 2.0 is for magnifying
  
  xPosition = (float)tvarX;
  yPosition = (float)tvarY;
  </code></pre>
  
  <p>But the values of tvarx using this approach are always switching between back and forth from infinity to 0. Can anybody please suggest me any approach to change the values and convert them into screen coordinates for drawing a proper sine wave?</p>
  
  <p>Thanks :-)</p>