Android Edittext Typed Text Not Showing

I know I've seen this question a thousand times by now, but haven't found an answer that has worked. In my app I have an Edittext box. When I run the app on the emulator or my phone, no text shows when typing in the edittext. The cursor moves, and I can get the value that I typed in, just nothing shows while typing. I've tried changing the color of the text, the color of the background and every other solution that I've come across, but nothing has worked.

Here is my xml for the edittext

 <EditText android:id="@+id/editChannel_no"
        android:layout_toRightOf="@+id/Channo"
        android:layout_width="35dp"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/Channo"
        android:inputType="number"
        android:hint="2"
        android:cursorVisible="true" />

Here is the only code used with the edittext

 EditText editChannel_no;
    Button btnSearch;
    Button btnShowAll;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //<item android:id="@+id/action_settings" android:title="@string/action_settings"
        //android:orderInCategory="100" app:showAsAction="never" />


        editChannel_no=(EditText)findViewById(R.id.editChannel_no);
        editChannel_no.requestFocus();
        btnSearch=(Button)findViewById(R.id.btnSearch);
        btnShowAll=(Button)findViewById(R.id.btnShowAll);

        editChannel_no.setTextColor(Color.BLACK);

I've been trying to find a solution for 2 days now, and anyone that solves this will be my hero.

Thanks

3

5 Answers

Tried out your code - in my emulator it's working as expected (I am using Genymotion). Are you sure you are typing numbers in the Edittext? android:inputType="number" specifies you only enter number as inputs.

Please add this line in to the <activity>

android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
</Activity>

and Remove the line from manifest file android:hardwareAccelerated="false"

1

I have had a similar problem where what I am typing does not appear unless I dismiss the keyboard by clicking the back button, I solved it by this to the activity in the manfiest :

android:windowSoftInputMode="adjustResize"

instead of android:windowSoftInputMode="adjustPan"

After all this time, the issue was that the edittext was to close to the title bar. Shows how much of a noob I am at android programming.

1

I run the same XML code of you that working fine in my case
what you can do is

  1. Restart your Android Studio if you are using it otherwise the IDE you are using.
  2. Sync. your project using the below icon.

Run again one of the above should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest