📜  测试editText是否为空java代码示例

📅  最后修改于: 2022-03-11 14:52:17.459000             🧑  作者: Mango

代码示例1
if (TextUtils.isEmpty(editText.getText().toString()))
{
    Toast.makeText(MainActivity.this, 
                   "Empty field not allowed!",
                   Toast.LENGTH_SHORT).show();
}
else 
{
    Toast.makeText(MainActivity.this,
                  "Proceed..",
                  Toast.LENGTH_SHORT).show();
}