Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.io.IOException;
import java.io.InputStream;

import java.net.MalformedURLException;

import android.graphics.drawable.Drawable;

public class Main {
    public static Drawable photo_fetch(String img) {
        Drawable image = null;
        try {
            System.out.println("Inside Run !");
            java.net.URL u = new java.net.URL(img);
            Object content = u.getContent();
            InputStream is = (InputStream) content;
            image = Drawable.createFromStream(is, "src");
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        System.out.println("Returning ffrom heew !");
        return image;
    }
}