Для создания обработчиков кнопок необходимо знать следующие особенности:
Необходимо создать несколько глобальных переменных, которые будут: отвечать за поле вывода вычислений, отвечать за поле вывода результата вычислений, отвечать за выполняемую операцию, проверять совершается ли операция. Возможно потребуются дополнительные переменные для промежуточных операций.
В функции onCreate кроме задания интерфейса через senContentView необходимо будет найти текстовые поля через функцию findViewById для того, чтобы с этими объектами можно было взаимодействовать.
Не нужно создавать отдельную функцию для взаимодействия с каждой кнопкой. Например, можно создать 4 функции для взаимодействия с кнопками - для цифр, для операций, для кнопки удаления, для кнопки равенства.
Главное условие для создания калькулятора:
Операции работают без ошибок.
Есть промежуточные вычисления.
При нажатии на кнопку равенства вычисления прекращаются, записывается окончательный результат.
Ниже представлен один из примеров реализации для простого калькулятора.