Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.IOException;

import android.content.Context;

import android.graphics.drawable.Drawable;

public class Main {
    /**
     * get Drawable from assert
     * 
     * @param context
     * @param fileName
     * @return
     */
    public static Drawable getDrawableFromAssets(Context context, String fileName) {
        try {
            return Drawable.createFromStream(context.getAssets().open(fileName), fileName);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}