How to call method in android so able to run code

You should call that method inside OnCreate()

 @Override
 protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_calculator);
      calculator();
 }

Leave a Comment