title: Draw on a canvas with Bitmap as Background
body: <p>I am trying to draw on a picture i have taken. 
  Drawing works without the picture drawn but if i draw the bitmap i only see the bitmap but n drawing comes up.
  I tried a lot but nothing seems to help.
  Thanks in advance.</p>
  
  <pre><code>private class myView extends View implements OnTouchListener{
  
      File root = Environment.getExternalStorageDirectory();
      Path path;
      ArrayList&lt;Path&gt; _graphics = new ArrayList&lt;Path&gt;();
      Bitmap myBitmap;
      Paint myPaint;
  
      public myView(Context context) {
          super(context);
  
          File file = new File(root, "temp.jpg");
          myBitmap = null;
          if (file.exists()) {
              BitmapFactory.Options options = new BitmapFactory.Options();
              options.inPreferredConfig = Bitmap.Config.ARGB_8888;
              myBitmap = setBitmap(BitmapFactory.decodeFile(new File(root,
                      "temp.jpg").getPath(), options));
          }
  
          myPaint = new Paint();
          myPaint.setColor(Color.GREEN);
          myPaint.setStyle(Paint.Style.STROKE);
          myPaint.setStrokeWidth(3);
      }
  
      @Override
      protected void onDraw(Canvas canvas) {          
          canvas.drawBitmap(myBitmap, 0, 0, null);
          for (Path path : _graphics) {
               canvas.drawPath(path, myPaint);
          }
      }
  
      @Override
      public boolean onTouch(View v, MotionEvent event) {
          if (event.getAction() == MotionEvent.ACTION_DOWN) {
              path = new Path();
              path.moveTo(event.getX(), event.getY());
          } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
              path.lineTo(event.getX(), event.getY());
          } else if (event.getAction() == MotionEvent.ACTION_UP) {
              path.lineTo(event.getX(), event.getY());
              _graphics.add(path);
          }
  
          return true;
      }
  }
  </code></pre>