Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/178.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 编辑文本不更新_Android - Fatal编程技术网

Android 编辑文本不更新

Android 编辑文本不更新,android,Android,下面是我的onCreate方法的最后一部分 if (prevIntent.hasExtra("name")) { nameField.setText(prevIntent.getStringExtra("name"), TextView.BufferType.EDITABLE); Toast.makeText(getApplicationContext(), "name = " + prevIntent.getStringExtra("name"

下面是我的
onCreate
方法的最后一部分

if (prevIntent.hasExtra("name")) {
            nameField.setText(prevIntent.getStringExtra("name"), TextView.BufferType.EDITABLE); 
            Toast.makeText(getApplicationContext(), "name = " + prevIntent.getStringExtra("name"), Toast.LENGTH_LONG).show();
            Toast.makeText(getApplicationContext(), "nameField = " + nameField.getText().toString(), Toast.LENGTH_LONG).show();
}

活动会显示
name=Some name
nameField=Some name
,但我看到的是布局文件中定义的文本。为什么会发生这种情况?我可以做些什么使文本字段显示它设置为显示的文本?

代码是否实际执行?有人给我举杯吗?有。代码被执行。祝酒词确实出现了。