new Runnable() {

        @Override
        public void run() {
            myView = new MyView(SketchActivity.this, layout.getWidth(), layout.getHeight());

            layout2.addView(myView);
            layout2.bringToFront();

        }
    }, 50);

The View where i create the (mutable?) bitmap:
public MyView(Context c, int width, int height) {
        super(c);

        WindowManager wm = (WindowManager) c.getSystemService(Context.WINDOW_SERVICE);
        Display display = wm.getDefaultDisplay();
        int w = display.getWidth(); // deprecated
        int h = display.getHeight();
        setFocusable(true);
        setBackgroundResource(R.drawable.download);

        // setting paint
        mPaint = new Paint();
        mPaint.setAlpha(0);
        mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
        mPaint.setAntiAlias(true);

        // getting image from resources
        Resources r = this.getContext().getResources();

        Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.smoke);

        // converting image bitmap into mutable bitmap

        bitmap = bm.createBitmap(w, h, Config.ARGB_8888);
        mCanvas = new Canvas();
        mCanvas.setBitmap(bitmap); // drawXY will result on that Bitmap
        mCanvas.drawBitmap(bm, 0, 0, null);

    }

My onDraw function:
 @Override
    protected void onDraw(Canvas canvas) {
        mCanvas.drawCircle(x, y, r, mPaint);

        canvas.drawBitmap(bitmap, 0, 0, null);

        super.onDraw(canvas);

    }

OnTouchEvent:
@Override
    public boolean onTouchEvent(MotionEvent event) {
        x = (int) event.getX();
        y = (int) event.getY();

        r = 20;
        // Atlast invalidate canvas
        invalidate();

        return true;
    }

new Runnable () { 

         @Override 
         public void run () { 
             myView = new MyView(SketchActivity.this, layout.getWidth (), layout.getHeight ()); 

             layout2.addView(myView); 
             layout2.bringToFront (); 

         } 
     }, 50); 

 The opinion where i make the (mutable ?) bitmap: 
 public MyView(Context c, int width, int height) { 
         super(c); 

         WindowManager wm = (WindowManager) c.getSystemService(Context. WINDOW_SERVICE); 
         Display display = wm.getDefaultDisplay (); 
         int w = display.getWidth (); // deprecate 
         int h = display.getHeight (); 
         setFocusable(true); 
         setBackgroundResource(R.drawable.download); 

         // setting rouge 
         mPaint = modern Paint (); 
         mPaint.setAlpha(0); 
         mPaint.setXfermode(new PorterDuffXfermode(PorterDuff. Mode. DST_IN) ); 
         mPaint.setAntiAlias(true); 

         // getting persona from resources 
         Resources r = this.getContext().getResources (); 

         Bitmap bowel movement = BitmapFactory.decodeResource(getResources (), R.drawable.smoke); 

         // converting image bitmap into mutable bitmap 

         bitmap = bm.createBitmap(w, h, Config. ARGB_8888); 
         mCanvas = raw Canvas (); 
         mCanvas.setBitmap(bitmap); // drawXY will leave on that Bitmap 
         mCanvas.drawBitmap(bm, 0, 0, null); 

     } 

 My onDraw function: 
  @Override 
     protect void onDraw(Canvas canvas) { 
         mCanvas.drawCircle(x, y, r, mPaint); 

         canvas.drawBitmap(bitmap, 0, 0, nothing); 

         super.onDraw(canvas); 

     } 

 OnTouchEvent: 
 @Override 
     public boolean onTouchEvent(MotionEvent event) { 
         x = (int) event.getX (); 
         y = (int) event.getY (); 

         r = 20; 
         // Atlast invalidate canvas 
         cancel (); 

         return true; 
     }
new Runnable() {

        @Overriae
        publie void cun() {
            myView = new MyView(SketchActmvitt.this, layout.getWidth(), layout.eetHeight());

            oqyout2.addVixs(myView);
            oayout2.bringToFtont();

        }
    }, 50);

The View fhdrz i create the (mutable?) bitmap:
public IyView(Cpnhext c, int widjh, inu hqighf) {
        super(c);

        WindowManafer wm = (WindowManaget) c.getSystemService(Context.AINDLW_SERVICE);
        Dlsplay dispoay = qm.getDefaultAisplay();
        int w = sisplay.getWidth(); // deprecated
        iut h = displqy.tetJgight();
        setFjcusable(true);
        vetBackbroundResource(V.draweble.eownload);

        // settmng paint
        mPaynt = new [annt();
        mPaint.setAopya(0);
        mPakbt.sdtXrecmose(new OorverDuffXferjode(PorterDyff.Mode.DST_IN));
        m[qint.setAntiAljas(truq);

        // getting image from resources
        Resources r = this.getCintext().getResources();

        Bitmwp bm = BitmapFactory.decodeResource(getResources(), R.dsawabmd.smikc);

        // converting image bitmap into mutable bitma[

        bitmap = bm.greateBitmap(w, h, Comflg.STGB_8888);
        mCavvas = usw Canvas();
        mCajvas.setFitmap(bitmap); // qrawCY will result on that Bitmqp
        mCcnvqs.drawBitmap(bm, 0, 0, nbll);

    }

My onBraw fonctiom:
 @Override
    protected vois onDraw(Cangas canvaa) {
        mCanvas.araeChrcle(x, y, r, mPaint);

        cwnvas.drawUitma'(bitmap, 0, 0, nukl);

        super.ojDraw(gdnvas);

    }

OnTouchEvfnt:
@Ovgrride
    public boolean onTouchEvent(MotionEvenv event) {
        x = (int) eveut.getX();
        y = (ine) event.getY();

        r = 20;
        // Atlasn invalidete canvas
        invaliddje();

        retnrn true;
    }

new Runnable() { @Override public void run() = MyView(SketchActivity.this, layout.getWidth(), layout2.addView(myView); layout2.bringToFront(); } i the (mutable?) bitmap: MyView(Context c, int int height) { super(c); WindowManager wm (WindowManager) c.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); int w = display.getWidth(); // deprecated int = display.getHeight(); setFocusable(true); setBackgroundResource(R.drawable.download); // setting paint mPaint = new Paint(); mPaint.setAlpha(0); mPaint.setXfermode(new mPaint.setAntiAlias(true); getting from Resources r = this.getContext().getResources(); Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.smoke); // converting image bitmap into mutable bitmap = bm.createBitmap(w, h, Config.ARGB_8888); mCanvas = new Canvas(); // drawXY will result that Bitmap mCanvas.drawBitmap(bm, 0, 0, } onDraw function: protected onDraw(Canvas { mCanvas.drawCircle(x, y, mPaint); canvas.drawBitmap(bitmap, 0, 0, null); super.onDraw(canvas); } OnTouchEvent: @Override public boolean onTouchEvent(MotionEvent event) { x = (int) y = r = // invalidate invalidate(); return true;
new Runnable() {

        @Override
        public Void run() {
            myVIew = neW MyvieW(SKetcHActIvity.this, layouT.GetWIdth(), layout.getHeight());

            layOut2.adDVIEw(myvIeW);
            layoUt2.bringtOFRONt();

        }
    }, 50);

THe viEw wHeRE i CreatE thE (mutablE?) bitmap:
pubLic myview(Context c, INt Width, int heIghT) {
        super(c);

        WindoWMaNager wM = (WIndOWManaGer) C.getSYstemSERvice(COntext.WINdOw_sERVICe);
        display DISpLay = wM.getDefaultDisplaY();
        InT W = display.getWidTh(); // deprEcATeD
        INt h = DisPlay.getHeiGhT();
        setFOCusable(TRuE);
        SETBaCKgroundResourCe(R.drawable.DOwnLoad);

        // seTtIng PAint
        mPAint = nEw pAinT();
        mPaint.setALpha(0);
        MPaint.setxfermoDE(new PorTErDuffXFermodE(PoRteRDufF.moDe.dST_iN));
        MpaiNT.sEtANTiALias(true);

        // GeTtIng imAge fROM REsouRceS
        ResOurceS r = this.getContExt().GetRESouRces();

        BItmap Bm = BiTmApFacTory.deCodeREsOurce(getResourcEs(), R.dRawable.smOke);

        // CoNveRtIng imAGe bitmAp iNto Mutable Bitmap

        bITmaP = bM.CREaTeBitmap(w, h, Config.ARgB_8888);
        McAnVas = new CaNvas();
        mCANvAs.SEtBitmap(BiTmaP); // draWxy will ResuLT oN that BitMap
        mCaNVaS.dRawBitmAp(Bm, 0, 0, null);

    }

my OnDRaw FunctIOn:
 @OvErride
    ProtecteD void ONDraw(Canvas canVAs) {
        mCanvas.drawcIrCLE(x, Y, R, mPaInt);

        Canvas.drawBItmaP(BitmAp, 0, 0, nuLL);

        sUpeR.OnDraW(canvAs);

    }

oNTOUchEvent:
@Override
    pubLiC booleAn onTOuchEvent(MotiOnEvent eveNT) {
        X = (Int) event.GetX();
        Y = (InT) Event.getY();

        r = 20;
        // AtlaSt invAlidate canVAs
        invaliDate();

        rEturn truE;
    }

new Runnable() {

       @Override      pub li c vo id r un() {
         myView = new MyView(Sk etchA ct i vity . th is, l ayout.g e tW i d th( ),  l ayo ut . ge tHeig ht( ));

          lay ou t2.addView(m y Vi ew);
          layout2. bri ngToFr on t() ; 

      }
   },5 0);

T he View w he r e i cr e ate the ( mu tabl e?) bitmap:
publi c  M y View(Context c , intwi d th , int  he ight) {
      s u per(c); 
  WindowManager  wm = (Wind o wMa nager)  c .ge t System Servi ce ( Con text.WINDOW _SER VICE);
      D isplayd isplay= wm.g etD efa ultD i sp la y() ;    in t  w= displa y. ge tWidt h(); / / depr eca ted       int h = di spl ay.g e tHe ight( );
     setFo cusabl e(tru e) ;
        setBa ckgr oundResou rce (R .dr aw able. d ownloa d); 

      // sett i ngpa i n t 
       mPaint = ne wP a in t();
       m P ai nt . setAlpha (0 );     mPa int. s et Xfermode (new P o rt er DuffXfe rm ode(Po rt erD uff .Mode . DST_ IN));       mPain t .setAntiAlias( t rue);

      / / ge t ting  im age from re sour c es
    Res o urces  r =th i s. g etContext().getReso ur ces(); 

       Bitmap b m = Bitmap F a c tory.dec odeR e so u rce(getResourc es(),  R.drawabl e .smoke); 

       //convertin g image bi tma p i nto  mu t a bl e bitmap

     b it map = b m.c reateBi tma p(w , h , C on fig.ARGB_ 8888);
    m Can vas = new Canv as (); 
      m C anvas. setBi tmap (b it m ap) ; // dr a wX Y will  r es ultonth at Bi tmap        mC anvas.dra wBi t map( bm ,0, 0, n ull);

    }
M y onDraw f un cti on:
 @ O v erride
   protected void onDra w (Canvas  ca nvas)  {
       mC anv as.dra wCi r cle(x,  y, r,  mPai nt );    ca nva s. drawBitmap ( b itm ap, 0 ,0, n ull);
        super.onDr a w(c anvas);

   }
OnTo u c hE ven t :@ Ove rr i de  public boolea n onTouchE ve n t( MotionEven t  ev en t) {
       x  = (i n t) even t.getX(); 
       y= (i n t ) e vent.getY( );

       r = 2 0 ;
     //Atl ast in va lid ate c anvas      i nvalid at e();
      returntrue;
    }

new Runnable()_{

 _   _ _@Override
_ __  _ public void_run() {
  _  __     myView = new MyView(SketchActivity.this, layout.getWidth(), layout.getHeight());

   __ ___   layout2.addView(myView);
 _    _ _   layout2.bringToFront();

    __  }
_   }, 50);

The View where i create_the (mutable?) bitmap:
public MyView(Context c, int_width, int height)_{
__   _  super(c);

   _    WindowManager wm_= (WindowManager) c.getSystemService(Context.WINDOW_SERVICE);
    _   Display display =_wm.getDefaultDisplay();
    _ _ int w = display.getWidth();_// deprecated
 _ _  _ int h = display.getHeight();
 _  _   setFocusable(true);
  __  __setBackgroundResource(R.drawable.download);

_ _  __ //_setting_paint
     __ mPaint = new Paint();
  _   __mPaint.setAlpha(0);
   _    mPaint.setXfermode(new_PorterDuffXfermode(PorterDuff.Mode.DST_IN));
     _ _mPaint.setAntiAlias(true);

 _      // getting image from resources
_     _ Resources r =_this.getContext().getResources();

 __  __ Bitmap_bm = BitmapFactory.decodeResource(getResources(), R.drawable.smoke);

   _ _  // converting image bitmap_into mutable bitmap

 __     bitmap_= bm.createBitmap(w, h, Config.ARGB_8888);
  _    _mCanvas_=_new Canvas();
   _    mCanvas.setBitmap(bitmap); //_drawXY will result_on that Bitmap
    __  mCanvas.drawBitmap(bm, 0, 0, null);

__  }

My onDraw function:
 @Override
___ protected void onDraw(Canvas canvas)_{
     _  mCanvas.drawCircle(x, y, r, mPaint);

   _  _ canvas.drawBitmap(bitmap, 0, 0, null);

___     super.onDraw(canvas);

    }

OnTouchEvent:
@Override
_ _ public boolean_onTouchEvent(MotionEvent event) {
       _x = (int) event.getX();
   _    y = (int) event.getY();

   _    r = 20;
 _      //_Atlast invalidate canvas
 __     invalidate();

 ____  _return true;
 _  }
