use of android.view.InflateException in project little-bear-dictionary by daimajia.
the class GenericInflater method createItem.
@SuppressWarnings("unchecked")
public final T createItem(String name, String prefix, AttributeSet attrs) throws ClassNotFoundException, InflateException {
Constructor<?> constructor = GenericInflater.constructorMap.get(name);
try {
if (constructor == null) {
Class<?> clazz = context.getClassLoader().loadClass(prefix != null ? prefix + name : name);
constructor = findConstructor(clazz);
GenericInflater.constructorMap.put(name, constructor);
}
Object[] args = constructorArgs;
args[1] = attrs;
return (T) constructor.newInstance(args);
} catch (NoSuchMethodException e) {
InflateException ie = new InflateException(attrs.getPositionDescription() + ": Error inflating class " + (prefix != null ? prefix + name : name));
ie.initCause(e);
throw ie;
} catch (Exception e) {
InflateException ie = new InflateException(attrs.getPositionDescription() + ": Error inflating class " + constructor.toString());
ie.initCause(e);
throw ie;
}
}
Aggregations