未找到android studio toString方法

问题描述 投票:0回答:1

[我正在android studio中的项目上工作,但是当我想使用toString()方法时,它显示:无法解析方法'toString()'。请检查图像。enter image description here

etLPassword = findViewById(R.id.etLPassword);
    String password = etLPassword.getText().toString();

tostring()以红色显示

java android android-studio methods tostring
1个回答
0
投票

输入可能为空:您不能在null对象上使用toString()。您可以尝试使用Try-Catch,当引发异常时,您告诉用户在提交输入之前实际输入一些文本!

© www.soinside.com 2019 - 2024. All rights reserved.