假如想要判断两个字符串是否相同,可以使用string1.equals(string2),那么在Android中如何判断两个context是否相同呢?
if(c1.getClass().equals(c2.getClass()))
{
//The context is the same
}
else
{
//Context is different
}
if(context1.getClass().getName().equals("com.xxx.sameclass"))&&context2.getClass().getName().equals("com.xxx.sameclass")))
{
if(context1 == context2)
//same condition
}
context1.hashCode()==context2.hashCode()