title: Android Material Design TextInputEditText not able to get the string
body: <p>I am using material design in my android app registration page.  I have used the following code in my xml file.</p>
  <p>XML File</p>
  <pre><code>&lt;com.google.android.material.textfield.TextInputLayout
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:id=&quot;@+id/regEmailId&quot;
              android:hint=&quot;Email Id&quot;
              style=&quot;@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox&quot;&gt;
  
              &lt;com.google.android.material.textfield.TextInputEditText
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;wrap_content&quot;/&gt;
  
          &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  </code></pre>
  <p>The above xml is rendered from inside a linear layout.</p>
  <p>In my Java file, I have written the following:</p>
  <pre><code>TextInputLayout regMailId = findViewById(R.id.regEmailId);
  Editable regEmail =  regMailId.getEditText().getText();
  </code></pre>
  <p>I followed the option given in this SO post <a href="https://stackoverflow.com/questions/57797862/how-to-get-text-from-material-design-textinputlayout-correctly">here</a>.  Though the answer indicates I should use</p>
  <pre><code>String text = textInputLayout.getEditText().getText();
  </code></pre>
  <p>I am getting an error with Android Studio forcing me to change this to:</p>
  <pre><code>Change variable text type to editable
  Migrate text type to editable
  Wrap using String.valueOf()
  </code></pre>
  <p>If I wrap using string value of</p>
  <pre><code>String text = String.valueOf( regMailId.getEditText().getText() );
  </code></pre>
  <p>I am not getting the output of variable text.</p>
  <p>When I changed it to</p>
  <pre><code>Editable regEmail =  regMailId.getEditText().getText();
  </code></pre>
  <p>I am able to toast the input text, but I could not get the actual text to do any validations on top of them.  For example, the <code>password</code> and <code>confirmpassword</code> fields, I am not able to compare though I could see the values getting toasted.</p>
  <p>When I tried to get the variable type for <code>regEmail</code>, I got the following toasted:</p>
  <pre><code>java.lang.String.android.text.SpannableStringBuilder
  </code></pre>
  <p>I tried extracting string by using toString(), getText().toString(), etc to the regEmail.  Nothing worked.</p>
  <p>How do I get the string of the textinput field in material design layout.</p>
  <p>The following is my app gradle:</p>
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 29
  
      defaultConfig {
          applicationId &quot;com.example.telescope&quot;
          minSdkVersion 16
          targetSdkVersion 29
          versionCode 1
          versionName &quot;1.0&quot;
          multiDexEnabled true
          testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
      }
  
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
  
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      implementation fileTree(dir: &quot;libs&quot;, include: [&quot;*.jar&quot;])
      implementation 'androidx.appcompat:appcompat:1.2.0'
      implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test.ext:junit:1.1.1'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
      implementation 'com.google.android.material:material:1.2.0'
      implementation 'com.android.support:multidex:2.0.0'
      implementation 'com.amplifyframework:core:1.1.2'
      implementation 'com.amplifyframework:aws-datastore:1.1.2'
      implementation 'com.amplifyframework:aws-api:1.1.2'
      implementation 'com.amplifyframework:aws-auth-cognito:1.3.0'
  
  }
  </code></pre>