Example usage for android.content.res Resources getMovie

List of usage examples for android.content.res Resources getMovie

Introduction

In this page you can find the example usage for android.content.res Resources getMovie.

Prototype

public Movie getMovie(@RawRes int id) throws NotFoundException 

Source Link

Document

Return a movie object associated with the particular resource ID.

Usage

From source file:Main.java

public static Object getResource(Context context, Field field, int value) {
    Resources resources = context.getResources();
    Class type = field.getType();

    if (type.isAssignableFrom(Boolean.TYPE) || type.isAssignableFrom(Boolean.class))
        return resources.getBoolean(value);
    else if (type.isAssignableFrom(Integer.TYPE) || type.isAssignableFrom(Integer.class)) {
        return resources.getInteger(value);
    } else if (type.isAssignableFrom(ColorStateList.class))
        return resources.getColorStateList(value);
    else if (type.isAssignableFrom(XmlResourceParser.class))
        return resources.getXml(value);
    else if (type.isAssignableFrom(Float.TYPE) || type.isAssignableFrom(Float.class))
        return resources.getDimension(value);
    else if (type.isAssignableFrom(Drawable.class))
        return resources.getDrawable(value);
    else if (type.isAssignableFrom(Animation.class))
        return AnimationUtils.loadAnimation(context, value);
    else if (type.isAssignableFrom(Movie.class))
        return resources.getMovie(value);
    else if (type.isAssignableFrom(String.class))
        return resources.getString(value);
    else if (type.isArray()) {
        if (type.getName().equals("[I")) {
            return resources.getIntArray(value);
        } else if (type.isAssignableFrom(String[].class)) {
            return resources.getStringArray(value);
        }//from   ww w.  j a v  a 2 s  .  com
    }

    return null;
}