I created a "register" screen where the user informs the name / surname and where there is a Continue button that goes to another screen. I would like this new screen to open when the user hit Enter, but I do not know how to make the Enter key have this function.
Below the home screen code
public class CadastroActivity extends AppCompatActivity {
EditText edtNome;
Button btnContinuar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cadastro);
edtNome = (EditText) findViewById(R.id.edtNome);
btnContinuar = (Button) findViewById(R.id.btnContinuar);
btnContinuar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent EnviarDados = new Intent(CadastroActivity.this, ResultadoActivity.class);
String txtNome = edtNome.getText().toString();
Bundle bundle = new Bundle();
bundle.putString("nome", txtNome);
EnviarDados.putExtras(bundle);
startActivity(EnviarDados);
}
});
}
}