‫Welcome back.
‫Now let's handle the click event on this button.
‫So button dot set on Click Listener.
‫And I will choose this lambda expression.
‫Here I need to get the radius from the edit text and do the calculation based on the radius passed by
‫the user in the edit text.
‫So var radius equals.
‫To edit text dot get text dot two string.
‫I need to change and transform this string radius to an int.
‫So int r var r equals to integer dot parse int.
‫And here I need to pass the radius as a string.
‫So I'm converting the string passed by the edit text to an int.
‫Now the volume of the sphere is four over three times pi times three cube or radius cube.
‫For that I will create a double variable called volume.
‫Volume equals to four over three times 3.14 15 nine times r times r times r.
‫This is how we write our cube.
‫Or you can use math dot power function from the math package result dot set text.
‫Here text equals to v equals to volume variable plus m cube okay so it's in meter.
‫Cube.
‫Let me run.
‫This is our application.
‫Click on sphere.
‫Here we are directed to the sphere activity.
‫Please enter the radius I will enter three as a radius three meters calculate volume.
‫And here we go.
‫The volume of the sphere is 84.822.
‫And so on.
‫Meters cube okay so this is how we handle the click event on the button calculate volume.
‫How we do calculations based on the radius passed in the edit text.