Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.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 view.getText().toString()是否从DialogFragment中不返回任何内容?_Android - Fatal编程技术网

Android view.getText().toString()是否从DialogFragment中不返回任何内容?

Android view.getText().toString()是否从DialogFragment中不返回任何内容?,android,Android,我有一个自定义的DialogFragment类。用户在2个editText视图中键入密码两次。当我记录该操作时,即使我在两个EditText中都键入了一些文本,但两个EditText都会显示一条空文本: D/CreateNewWalletDialogFragment:密码:密码重复: 正如有人建议的那样,onStart()方法中的绑定视图对我也没有帮助。有什么建议吗?我认为这应该是EditText,而不是TextView 试试这个 @BindView(R.id.password_edit) Ed

我有一个自定义的DialogFragment类。用户在2个editText视图中键入密码两次。当我记录该操作时,即使我在两个EditText中都键入了一些文本,但两个EditText都会显示一条空文本:

D/CreateNewWalletDialogFragment:密码:密码重复:


正如有人建议的那样,
onStart()
方法中的绑定视图对我也没有帮助。有什么建议吗?

我认为这应该是EditText,而不是TextView

试试这个

@BindView(R.id.password_edit)
EditText password;
@BindView(R.id.password_edit_repeat)
EditText password_repeat;

我认为这应该是EditText,而不是TextView

试试这个

@BindView(R.id.password_edit)
EditText password;
@BindView(R.id.password_edit_repeat)
EditText password_repeat;
问题在于:

ButterKnife.bind(this, View.inflate(getContext(), R.layout.create_wallet_popup, null));
builder.setView(inflater.inflate(R.layout.create_wallet_popup, null))
注意到您有两个
充气
s?Inflates每次收到调用时都返回一个新实例,因此,在您的情况下,屏幕上提示的视图与ButterKnife绑定的视图不同。试一试

 View view = View.inflate(getContext(), R.layout.create_wallet_popup, null);
 ButterKnife.bind(this, view);
 builder.setView(view)
问题在于:

ButterKnife.bind(this, View.inflate(getContext(), R.layout.create_wallet_popup, null));
builder.setView(inflater.inflate(R.layout.create_wallet_popup, null))
注意到您有两个
充气
s?Inflates每次收到调用时都返回一个新实例,因此,在您的情况下,屏幕上提示的视图与ButterKnife绑定的视图不同。试一试

 View view = View.inflate(getContext(), R.layout.create_wallet_popup, null);
 ButterKnife.bind(this, view);
 builder.setView(view)

EditText
TextView
的一个子类,它无论如何都应该可以工作,因为@Blackbelt说过。但就我而言,我应该把它改成EditText。谢谢你的建议。
EditText
TextView
的一个子类,不管怎样它都应该可以工作,因为@Blackbelt说过。但就我而言,我应该把它改成EditText。谢谢你的建议。谢谢,这是正确的。现在有道理了。如果时间允许,我会接受答案。谢谢你的帮助。谢谢,这是正确的。现在有道理了。如果时间允许,我会接受答案。谢谢你的帮助。