Android Build an Interactive Story App Intents and Multiple Activities Getting Text from an EditText

Victor Cuc
Victor Cuc
7,281 Points

Bug with typing in the EditText field. When i type my first letter the text field retracts under the keyboard.

The keyboard stays up, frozen, even if i tap the back button once to retract it. If i tap it a second time, it returns to the home screen.

If I comment the lines dealing with the inputs, the keyboard still crashes, but only sometimes... Is this a problem with the current version of android on my phone?

package com.victorcuc.signalsfrommars;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    private EditText nameField;
    private Button startButton;

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

        nameField = findViewById(R.id.nameEditText);
        startButton = findViewById(R.id.startButton);

        startButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String name = nameField.getText().toString();
                Toast.makeText(MainActivity.this, name, Toast.LENGTH_LONG).show();
            }
        });
    }
}
Victor Cuc
Victor Cuc
7,281 Points

I've tested it on an emulated device as well (Nexus 5 API 25 - Android 7.1.1) and seems to be working perfectly fine here. So it probably is a bug with the version on my phone or with GBoard.

Still, is there a fix? (I'm running it on a Google Pixel 2 XL - Android 8.1.0 - API 27)