title: Plus and minus button with EditText
body: <p>I have a functioning button with increment and decrement functioning correctly. but I have the need that I can also enter the value manually with an EdidText.</p>
  
  <p>My code is the following:</p>
  
  <p>Activity.tk</p>
  
  <pre><code>import android.support.v7.app.AppCompatActivity
  import android.os.Bundle
  import android.view.View
  import android.widget.Button
  import android.widget.TextView
  
  class MainActivity : AppCompatActivity() {
      internal var minteger = 0
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
  
  
          val plus = findViewById&lt;Button&gt;(R.id.increase)
          val minus = findViewById&lt;Button&gt;(R.id.decrease)
  
          plus.setOnClickListener {
  
              increaseInteger(plus)
          }
  
  
  
          minus.setOnClickListener {
  
              decreaseInteger(minus)
          }
      }
  
      fun increaseInteger(view: View) {
          minteger += 1
          display(minteger)
  
      }
  
      fun decreaseInteger(view: View) {
          minteger -= 1
          display(minteger)
      }
  
      private fun display(number: Int) {
          val displayInteger = findViewById&lt;View&gt;(
                  R.id.integer_number) as TextView
          displayInteger.text = "" + number
      }
  }
  </code></pre>
  
  <p>activity_main.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_margin="16dp"
      android:gravity="center_horizontal"
      android:orientation="vertical"
      tools:context=".MainActivity"&gt;
  
  
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginTop="56dp"
          android:orientation="horizontal"&gt;
  
          &lt;Button
              android:id="@+id/decrease"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="-" /&gt;
  
          &lt;TextView
              android:id="@+id/integer_number"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginBottom="16dp"
              android:layout_marginLeft="40dp"
              android:layout_marginRight="40dp"
              android:layout_marginTop="16dp"
              android:text="0"
              android:textStyle="bold"
              android:textSize="70sp" /&gt;
  
          &lt;Button
              android:id="@+id/increase"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="+" /&gt;
      &lt;/LinearLayout&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I have changed the TextView with an EditText (<code>@+id/integer_number</code>)</p>
  
  <p>But when I enter a value that is not saved, I can not find a way to make the value entered in the EdidText saved so that I can increase or decrease it.</p>
  
  <p>I will appreciate any suggestion to be able to operate my button.</p>
  
  <p><a href="https://i.stack.imgur.com/i6oIC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i6oIC.png" alt="buton"></a></p>