Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个联系人正在注册(只是为了测试),但是当它为空时,editText 仍然会将值发送到数据库,所以,我该如何删除它并为此创建一个 if/else 语句?我试过
if(myVariable == null){ code... }....
但它没有奏效,“null”是指空白但我不太了解它,因为我是新手。
因此,当您将其值发送到数据库时,您是否试图确保您的 EditText 不为空?
EditText text = ... if(text.getText.toString().length() != 0){ ...database code }