android 字符串操作

判断两个String是否相等不能直接用== 或!=,需要用equals()判断,若相等,则返回1

TextView A,B;
if (A.getText().toString.equals(B.getText().toString())) {
    //A=B;
}else{
    //A!=B;
}


判断TextView是否为空
if( "".equals(A.getText().toString())){
    //空
}else{
    //非空
}

猜你喜欢

转载自blog.csdn.net/qq_28938403/article/details/51488889