Example usage for android.view InflateException initCause

List of usage examples for android.view InflateException initCause

Introduction

In this page you can find the example usage for android.view InflateException initCause.

Prototype

public synchronized Throwable initCause(Throwable cause) 

Source Link

Document

Initializes the cause of this throwable to the specified value.

Usage

From source file:com.givewaygames.transition.TransitionInflater.java

/**
 * Loads a {@link Transition} object from a resource
 *
 * @param resource The resource id of the transition to load
 * @return The loaded Transition object/* ww w  . j a  v  a 2s .  co  m*/
 * @throws android.content.res.Resources.NotFoundException when the
 * transition cannot be loaded
 */
public Transition inflateTransition(int resource) {
    XmlResourceParser parser = mContext.getResources().getXml(resource);
    try {
        return createTransitionFromXml(parser, Xml.asAttributeSet(parser), null);
    } catch (XmlPullParserException e) {
        InflateException ex = new InflateException(e.getMessage());
        ex.initCause(e);
        throw ex;
    } catch (IOException e) {
        InflateException ex = new InflateException(parser.getPositionDescription() + ": " + e.getMessage());
        ex.initCause(e);
        throw ex;
    } finally {
        parser.close();
    }
}

From source file:android.support.transition.TransitionInflater.java

/**
 * Loads a {@link TransitionManager} object from a resource
 *
 * @param resource The resource id of the transition manager to load
 * @return The loaded TransitionManager object
 * @throws android.content.res.Resources.NotFoundException when the
 *                                                         transition manager cannot be loaded
 */// ww  w  .j a  v a2  s  .  c  o  m
public TransitionManager inflateTransitionManager(int resource, ViewGroup sceneRoot) {
    XmlResourceParser parser = mContext.getResources().getXml(resource);
    try {
        return createTransitionManagerFromXml(parser, Xml.asAttributeSet(parser), sceneRoot);
    } catch (XmlPullParserException e) {
        InflateException ex = new InflateException(e.getMessage());
        ex.initCause(e);
        throw ex;
    } catch (IOException e) {
        InflateException ex = new InflateException(parser.getPositionDescription() + ": " + e.getMessage());
        ex.initCause(e);
        throw ex;
    } finally {
        parser.close();
    }
}