Your Draw class extends the android class View.
You are adding a view to your layout in the onCreateMethod():
linearLayout.addView(draw);
Android will call the onDraw() method in the draw object when the view is rendering.
2
solved Calling the methods in java