title: how to draw a path in android on canvas
body: <p>how to draw a path in android on canvas from stored coordinates in database..</p>
  
  <p>i had tried fingerpaint but when i am fetching the co-ordinates 
  from the database its drawing a path from a different location and if i had put a single dot to draw it draws a line from last drawing to this dot..</p>
  
  <p>the following is code to read the coordinates from the database....</p>
  
  <pre><code>public Cursor read() {
      Cursor cur = db.query("path_new", null, null, null, null, null, null);
      StringBuffer sbx_read, sby_read;
  
      cur.moveToFirst();
      float x1 = 0, y1 = 0;
      int pid_read = 1;
      int cur_pid;
      float mX1 = 0, mY1 = 0;
      do {
  
          sbx_read = new StringBuffer();
          sbx_read.append(cur.getString(0));
          sby_read = new StringBuffer();
          sby_read.append(cur.getString(1));
          cur.moveToNext();
          Log.d("X", sbx_read.toString());
          Log.d("Y", sby_read.toString());
          Path mPath1 = new Path();
  
          String[] sbx_read_array = sbx_read.toString().trim().split(",");
          String[] sby_read_array = sby_read.toString().trim().split(",");
          // mPath.moveTo(x1, y1);
          for (int i = 0; i &lt; sbx_read_array.length; i++) {
  
              x1 = Float.parseFloat(sbx_read_array[i].toString());
              y1 = Float.parseFloat(sby_read_array[i].toString());
  
              mPath1.moveTo(x1, y1);
              // mPath.reset();
  
              // mX1 = x1;
              // mY1 = y1;
  
              float dx = Math.abs(x1 - mX1);
              float dy = Math.abs(y1 - mY1);
              if (dx &gt;= TOUCH_TOLERANCE || dy &gt;= TOUCH_TOLERANCE) {
                  mPath.reset();
                  mPath1.quadTo(mX1, mY1, (x1 + mX1) / 2, (y1 + mY1) / 2);
                  mX1 = x1;
                  mY1 = y1;
                  // Log.d("X1", String.valueOf(x1));
                  // Log.d("mX1", String.valueOf(mX1));
                  // Log.d("Y1", String.valueOf(y1));
                  // Log.d("mY1", String.valueOf(mY1));
  
                  mPath1.lineTo(mX1, mY1);
                  mCanvas.drawPath(mPath1, mPaint);
  
              }
          }
      } while (cur.moveToNext());
      cur.close();
      return cur;
  }
  </code></pre>
  
  <p>here i am getting the path from database into stringbuffer &amp; convert it into String array so the different paths can be store in different records..</p>
  
  <p>my table is...</p>
  
  <p><code>X-cordinatrs TEXT, Y-cordinatrs TEXT, Path_id INTEGER, PAGE_NO INTEGER</code></p>