Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class Main {
    public static Bitmap getBitmap(String biturl) {

        Bitmap bitmap = null;

        try {

            URL url = new URL(biturl);
            URLConnection conn = url.openConnection();
            InputStream in = conn.getInputStream();
            bitmap = BitmapFactory.decodeStream(new BufferedInputStream(in));

        } catch (Exception e) {

            e.printStackTrace();
        }
        return bitmap;

    }
}