-1

i have an activity which contain this seekbar and have another view of drawing which is drawing circle in Ondraw() mathod,i dont get any solution can anyone help.

here is my code
Activity.java

    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_crop);
    layout = (LinearLayout) findViewById(R.id.layout);

    sk = (SeekBar) findViewById(R.id.seekBar);


     drawing= new DrawView(this);

    sk.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
            size = i + 10;

        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {

        }

    });


    layout.addView(drawing);



}

here is my View have this mathod

    @Override
    public void onDraw(Canvas canvas) {

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

        canvas.drawPath(circlePath, circlePaint);

        canvas.drawCircle(x,y,size/2,showpaint);
    }

my problem is how to draw circle on realtime when seekbar is changing,if you need any further detail tell me.

jigar savaliya
  • 474
  • 1
  • 8
  • 21

1 Answers1

1

Try adding an updateSize(int size) method to the drawable that calls invalidate() to redraw every time the size changes.

Matt Vaughn
  • 191
  • 3