Android examples for java.lang.reflect:Object Type
is Object Instance Of a Class
//package com.java2s; public class Main { public static boolean isInstanceOf(Object obj, Class<?> clazz) { if (obj == null || clazz == null) { return false; }/*from w w w. j a v a 2 s. c om*/ Class<?> objClass = obj.getClass(); while (objClass != null) { if (clazz.equals(objClass)) { return true; } objClass = objClass.getSuperclass(); } return false; } }