title: How to disable dot button in android Kotlin
body: <p>I am new to Android Studio - Kotlin, I am building an app with numbers and math operators with decimal point(.dot button)In my math calculator app, if press the dot button, the button should be disabled or not entered for the second time.  I want to disable or stop printing dot button(.) if pressed more than once. </p>
  
  <p>Here is my code</p>
  
  <p>Acitivity.kt file</p>
  
  <pre><code>package com.tripbegins.calculator
  import android.support.v7.app.AppCompatActivity
  import android.os.Bundle
  import android.view.View
  import android.widget.Button
  import com.tripbegins.calculator.R.id.*
  import kotlinx.android.synthetic.main.activity_main.*
  
  class MainActivity : AppCompatActivity() {
  
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_main)
  }
  
  var emptyText = true
  fun numberEvents(view: View) {
  var checkButton:Boolean = false
      if(emptyText){
          viewResult.setText("")
      }
      emptyText = false
  
      var button = view as Button
      var isClicked = viewResult.text.toString()
      when (button.id) {
          buttonOne.id -&gt; isClicked += "1"
          buttonTwo.id -&gt; isClicked += "2"
          buttonThree.id -&gt; isClicked += "3"
          dotButton.id-&gt; isClicked+="."
      }
  
      viewResult.setText(isClicked)
  }
  
  var operation ="+"
  var oldValues:String? = null
  fun mathOperation(view: View){
      var mathButton = view as Button
      var isClicked = viewResult.text.toString()
  
      when(mathButton.id){
          plusButton.id-&gt; {
              operation = "+"
          }
          minusButton.id-&gt;{
              operation="-"
          }
          mulButton.id-&gt;{
              operation="*"
          }
  
      }
      oldValues = viewResult.text.toString()
      emptyText = true
  }
  
  fun Calculate(view: View){
  
      var newValues = viewResult.text.toString()
      var calulateButton:Double? = null
      when(operation){
          "+"-&gt; { calulateButton = oldValues!!.toDouble() + newValues.toDouble() }
          "-"-&gt; { calulateButton = oldValues!!.toDouble() - newValues.toDouble() }
          "*"-&gt; { calulateButton = oldValues!!.toDouble() * newValues.toDouble() }
  
      }
      viewResult.setText(calulateButton.toString())
      emptyText=true
  }
  fun clearFunction(view: View){
      viewResult.setText("")
  }
  }
  </code></pre>
  
  <p>activity.xml file</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
   &lt;android.support.constraint.ConstraintLayout 
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   tools:context="com.tripbegins.calculator.MainActivity"&gt;
  
  &lt;EditText
      android:id="@+id/viewResult"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginTop="42dp"
      android:ems="10"
      android:gravity="bottom|right"
      android:inputType="textPersonName"
      android:text="0"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent" /&gt;
  
  &lt;Button
      android:id="@+id/buttonTwo"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginStart="16dp"
      android:layout_marginTop="76dp"
      android:onClick="numberEvents"
      android:text="2"
      app:layout_constraintStart_toEndOf="@+id/buttonOne"
      app:layout_constraintTop_toBottomOf="@+id/viewResult" /&gt;
  
  &lt;Button
      android:id="@+id/plusButton"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginStart="38dp"
      android:onClick="mathOperation"
      android:text="+"
      app:layout_constraintBaseline_toBaselineOf="@+id/minusButton"
      app:layout_constraintStart_toStartOf="parent" /&gt;
  
  &lt;Button
      android:id="@+id/minusButton"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginStart="12dp"
      android:layout_marginTop="33dp"
      android:onClick="mathOperation"
      android:text="-"
      app:layout_constraintStart_toEndOf="@+id/plusButton"
      app:layout_constraintTop_toBottomOf="@+id/buttonTwo" /&gt;
  
  &lt;Button
      android:id="@+id/mulButton"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginStart="26dp"
      android:onClick="mathOperation"
      android:text="*"
      app:layout_constraintBaseline_toBaselineOf="@+id/minusButton"
      app:layout_constraintStart_toEndOf="@+id/minusButton" /&gt;
  
  &lt;Button
      android:id="@+id/calButton"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginTop="44dp"
      android:onClick="Calculate"
      android:text="Calculate"
      app:layout_constraintStart_toStartOf="@+id/minusButton"
      app:layout_constraintTop_toBottomOf="@+id/minusButton" /&gt;
  
  &lt;Button
      android:id="@+id/buttonThree"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginStart="26dp"
      android:onClick="numberEvents"
      android:text="3"
      app:layout_constraintBaseline_toBaselineOf="@+id/buttonTwo"
      app:layout_constraintStart_toEndOf="@+id/buttonTwo" /&gt;
  
  &lt;Button
      android:id="@+id/buttonOne"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginStart="34dp"
      android:onClick="numberEvents"
      android:text="1"
      app:layout_constraintBaseline_toBaselineOf="@+id/buttonTwo"
      app:layout_constraintStart_toStartOf="parent" /&gt;
  
  &lt;Button
      android:id="@+id/dotButton"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginEnd="22dp"
      android:onClick="numberEvents"
      android:text="."
      app:layout_constraintBaseline_toBaselineOf="@+id/calButton"
      app:layout_constraintEnd_toStartOf="@+id/calButton" /&gt;
  
  &lt;Button
      android:id="@+id/clearButton"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginStart="11dp"
      android:onClick="clearFunction"
      android:text="Clear"
      app:layout_constraintBaseline_toBaselineOf="@+id/calButton"
      app:layout_constraintStart_toEndOf="@+id/calButton" /&gt;
      &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p>My expectation of the result</p>
  
  <p>Valid entry -> 3. (.dot button should not be entered for the second time)</p>
  
  <p>Invalid entry -> 3... (currently i can able to enter multiple .dot buttons)</p>
  
  <p>Dot button should not pressed twice. It should be active only once.</p>
  
  <p>Thanks
  Mohammed</p>