我正在尝试在活动之间进行简单的信息转换。
问题是,在收到的活动中,我遇到了get.Extras() == null
helloName = (TextView) findViewById(surfaceName);
Bundle extra = getIntent().getExtras();
String nome = extra.getString("keyName");
System.out.println(nome) ; #PRINTING =null
helloName.setText("Olá "+nome);
Editable nome = name.getText();
System.out.println(nome);
Intent intent = new Intent(HelloActivity.this, MainActivity.class);
intent.putExtra("keyName",nome);
System.out.println(intent.getExtras());
startActivity(intent);
答案 0 :(得分:0)
试
Editable nome = name.getText();
System.out.println(nome);
Intent intent = new Intent(HelloActivity.this, MainActivity.class);
intent.putExtra("keyName",nome.toString());
System.out.println(intent.getExtras());
startActivity(intent);