Android 4.0不识别空

Android 4.0不识别空,android,Android,我在getview方法中有一个自定义gridview适配器,我正在检查字符串是否为NULL或空,但该条件似乎不起作用,因为它将字符串“NULL”打印到下面的文本视图是代码 if(!ThisAttendee.AllocatedTable.equals(null) && ThisAttendee.AllocatedTable.toLowerCase().trim() != "null" && !ThisAttendee.AllocatedTable.trim().is

我在getview方法中有一个自定义gridview适配器,我正在检查字符串是否为NULL或空,但该条件似乎不起作用,因为它将字符串“NULL”打印到下面的文本视图是代码

if(!ThisAttendee.AllocatedTable.equals(null) && ThisAttendee.AllocatedTable.toLowerCase().trim() != "null" && !ThisAttendee.AllocatedTable.trim().isEmpty())
        {
            ((TextView)(gridviewitem.findViewById(R.id.tv_attendeetable))).setText("Table: "+ThisAttendee.AllocatedTable);
        }

您需要使用
.equals()
而不是
=
来检查字符串是否为
“null”
, 和
=
而不是
equals()
来检查
null


请参见

我已将其更改为
if(thisaendee.AllocatedTable!=null&!thisaendee.AllocatedTable.toLowerCase().trim().equals(“null”)&&&!thisaendee.AllocatedTable.trim().equals(“”){((TextView)(gridviewitem.findViewById(R.tvúAttendedTable))).setText(“+thisaended.AllocatedTable);)
现在它只打印文本表,我尝试了您上面建议的方法,但同样的结果是,文本表来自xml,我将textview硬编码为在设计模式下可见的文本;)