如何查看联系人是否为phone联系人?

How to check whether the contact is phone contact or not?

我有一个对象类型的数组列表,它有两种联系人,一种是应用程序联系人,另一种是 phone 联系人...我需要根据结果隐藏一个特定的按钮。

谢谢

试试这样的东西:

if (items.elementAt(0) instanceof PhoneContact) {  //for example if the name of your class is PhoneContact
   //do something
} else if (items.elementAt(0) instanceof AppContact){  //if your class name is AppContact
    //do something else
}