How to check if a subclass is an instance of a class at runtime? [duplicate]
You have to read the API carefully for this methods. Sometimes you can get confused very easily. It is either: if (B.class.isInstance(view)) API says: Determines if the specified Object (the parameter) is assignment-compatible with the object represented by this Class (The class object you are calling the method at) or: if (B.class.isAssignableFrom(view.getClass())) API says: Determines … Read more