Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;
import android.graphics.drawable.Drawable;
import java.io.IOException;
import java.io.InputStream;

public class Main {
    public static Drawable getDrawableAsset(Context context, String path) {

        // Get input stream
        InputStream inputStream = null;
        try {
            inputStream = context.getAssets().open(path);
        } catch (IOException e) {
            e.printStackTrace();
        }
        // Load image as Drawable
        Drawable drawable = Drawable.createFromStream(inputStream, null);

        return drawable;
    }
}