Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.InputStream;

import java.net.URL;

import android.graphics.drawable.Drawable;

public class Main {
    /**
     * @param urlStr
     * @return
     * @throws Exception 
     */
    public static Drawable loadIBitmapDrawable(String urlStr) throws Exception {
        Drawable drawable = null;
        try {
            URL url = new URL(urlStr);
            InputStream inputStream = (InputStream) url.getContent();
            drawable = Drawable.createFromStream(inputStream, "src");
        } catch (Exception e) {
            throw e;
        }
        return drawable;
    }
}