Note that there are some explanatory texts on larger screens.

plurals
  1. POGet Text from Android Password TextView
    text
    copied!<p>I hope this hasn't been asked yet, since I couldn't find it. I am attempting to get a user's username and password for an online service. I created a username TextView and a password TextView. I'm able to get text out of the username TextView without problems. However, I can't get anything from the password TextView. Below is the XML:</p> <pre><code>&lt;TextView android:id="@+id/user_password" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="8dp" android:text="@string/passcodeQuery" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;EditText android:id="@+id/editText2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="8dp" android:layout_marginRight="8dp" android:layout_marginTop="8dp" android:hint="@string/passwordHint" android:inputType="textPassword" /&gt; </code></pre> <p>The problem is, if I run the code </p> <pre><code>TextView passField = (TextView)findViewById(R.id.user_password); </code></pre> <p>then </p> <pre><code>String toastMessage = "Password: " + passField.getText().toString(); </code></pre> <p>No matter what I put into the password field, the toast message gives me </p> <pre><code>Password: Password </code></pre> <p>I obviously won't be toasting the users password normally, I am just doing it now because I want to make sure I'm reading the inputs correctly. Unfortunately, that doesn't seem to be the case, as I can't read the password field. How do you get around that? Ton's of apps seem to be able to do it. Is there an easier way to get a password than what I'm doing?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload