Android examples for Graphics:Bitmap Option
get Bitmap Factory Options from URL
//package com.book2s; import android.graphics.BitmapFactory; import java.io.FileNotFoundException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static BitmapFactory.Options getBitmapFactoryOptions(String url) throws FileNotFoundException { try {/*from w ww.ja v a 2 s. c om*/ URL imageUrl = new URL(url); HttpURLConnection conn = (HttpURLConnection) imageUrl .openConnection(); conn.setConnectTimeout(30000); conn.setReadTimeout(30000); conn.setInstanceFollowRedirects(true); InputStream is = conn.getInputStream(); BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; BitmapFactory.decodeStream(is, null, o); return o; } catch (Exception ex) { ex.printStackTrace(); return null; } } }