I just want the editText.getText().toString()
to get the normal String inserted to the EditText but instead I'm getting it all uppercase no matter what.
Relevant XML:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/first_name_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/first_name_text"
android:textSize="20sp"
/>
<EditText
android:id="@+id/first_name_edit_text_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/first_name_hint_text"
/>
</LinearLayout>
Relevant Java:
sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
sharedPreferencesEditor = sharedpreferences.edit();
signUpButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
final String firstName = sharedpreferences.getString(FIRST_NAME_KEY, "");
sharedPreferencesEditor.putString(FIRST_NAME_KEY, firstNameEditText.getText().toString());
sharedPreferencesEditor.apply();
signUpButton.setText(firstName);
}
});
The firstName
which is a final
String variable is always uppercase. Now whys that? and how do i solve it?
Is this at all related to your problem? Why is my Button text forced to ALL CAPS on Lollipop?
I would try adding android:textAllCaps="false"
to the button.
Try to check the string by log
or by System.out.println()
. getText()
don`t make the text uppercase. see this thread Cannot lower case button text in android studio
Hope it helps you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.