Android Bitmap Load GetBitmap(String imageUrl)

Here you can find the source of GetBitmap(String imageUrl)

Description

Get Bitmap

Declaration

public static Bitmap GetBitmap(String imageUrl) 

Method Source Code

//package com.java2s;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

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

public class Main {
    public static Bitmap GetBitmap(String imageUrl) {
        Bitmap mBitmap = null;//from  ww  w  .  j  a va2s .co  m
        try {
            URL url = new URL(imageUrl);
            URLConnection conn = url.openConnection();
            InputStream is = conn.getInputStream();
            mBitmap = BitmapFactory.decodeStream(is);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return mBitmap;
    }
}

Related

  1. base642Bitmap(String string)
  2. decodeBitmap(Resources res, int resId)
  3. decodeBitmap(Resources res, int resId, int reqWidth, int reqHeight)
  4. decodeFromFile(String path)