decode Scaled Bitmap From URL - Android Graphics

Android examples for Graphics:Bitmap Scale

Description

decode Scaled Bitmap From URL

Demo Code


//package com.java2s;

import java.io.InputStream;
import java.net.URL;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class Main {
    private static BitmapFactory.Options options = null;

    public static Bitmap decodeScaledBitmapFromURL(URL imageUrl) {
        try {//from w  w w .  j  a v a  2 s  . c o m
            return BitmapFactory.decodeStream(
                    (InputStream) imageUrl.getContent(), null, options);

        } catch (Exception e) {
            e.printStackTrace();
        } catch (OutOfMemoryError e) {
            e.printStackTrace();
        }

        return null;
    }
}

Related Tutorials