Code example for BitmapFactory.Options

Methods: decodeStream

0
        String cacheName = mUrl;
        Bitmap bmp = ImageMap.getImage(cacheName);
        if (bmp == null) {
            try{ 
                URL url = new URL(mUrl);
                Options options = new BitmapFactory.Options();
                options.inPreferredConfig = Config.RGB_565;
                bmp = BitmapFactory.decodeStream(url.openStream(), null, options);
            } catch (MalformedURLException e) {
                return null; 
            } catch (IOException e) {
                return null; 
            } 
            ImageMap.setImage(cacheName, bmp);
        } 
        return bmp;
    } 
 
    /* (non-Javadoc) 
     * @see android.os.AsyncTask#onPostExecute(java.lang.Object) 
     */