-1
我有这个代码为Android应用程序的用户名字段。我想验证该字段是否为空。这里是我的代码:在字段中检索输入的文本(android帮助)
View a = findViewById(R.id.authentication);
(a.toString().equals(""))
我猜你不能使用视图来获取用户输入的数据。如果这些字段是空的,最好的方法是什么?
我有这个代码为Android应用程序的用户名字段。我想验证该字段是否为空。这里是我的代码:在字段中检索输入的文本(android帮助)
View a = findViewById(R.id.authentication);
(a.toString().equals(""))
我猜你不能使用视图来获取用户输入的数据。如果这些字段是空的,最好的方法是什么?
a.toString()不会做你认为它的作用。
使用TextView a = (TextView)findViewById(R.id.authentication); (a.getText().equals(""))