Search in sources :

Example 91 with InflateException

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;
    }
}
Also used : InflateException(android.view.InflateException) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) InflateException(android.view.InflateException) IOException(java.io.IOException)

Aggregations

InflateException (android.view.InflateException)91 IOException (java.io.IOException)46 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)45 AttributeSet (android.util.AttributeSet)28 XmlResourceParser (android.content.res.XmlResourceParser)18 Constructor (java.lang.reflect.Constructor)13 Path (android.graphics.Path)10 View (android.view.View)9 InvocationTargetException (java.lang.reflect.InvocationTargetException)6 StringTokenizer (java.util.StringTokenizer)6 NonNull (android.annotation.NonNull)5 SuppressLint (android.annotation.SuppressLint)5 PathParser (android.util.PathParser)5 TypedValue (android.util.TypedValue)5 ExpandedMenuView (android.support.v7.internal.view.menu.ExpandedMenuView)4 ActionBarView (android.support.v7.internal.widget.ActionBarView)4 ViewGroup (android.view.ViewGroup)4 AlertDialog (android.app.AlertDialog)2 Intent (android.content.Intent)2 Bitmap (android.graphics.Bitmap)2