Android Bitmap Thumbnail Create cacheAvatar(Context context, URI uri, Bitmap avatar)

Here you can find the source of cacheAvatar(Context context, URI uri, Bitmap avatar)

Description

cache Avatar

Declaration

private static void cacheAvatar(Context context, URI uri, Bitmap avatar) 

Method Source Code

//package com.java2s;

import java.io.IOException;

import java.net.URI;

import android.content.Context;
import android.graphics.Bitmap;

import android.graphics.Bitmap.CompressFormat;

import android.util.Log;

public class Main {
    private static final String TAG = "SOHelper";

    private static void cacheAvatar(Context context, URI uri, Bitmap avatar) {
        try {//www.jav  a  2 s. co m
            avatar.compress(CompressFormat.PNG, 0, context.openFileOutput(
                    String.format("%d.bmp", uri.hashCode()),
                    Context.MODE_PRIVATE));
        } catch (IOException ex) {
            Log.e(TAG, String.format("error caching %s", uri));
        }
    }
}

Related

  1. getImageThumbnail(String imagePath, int width, int height)
  2. extractThumbnail(Bitmap source, int width, int height)
  3. extractThumbnail(Bitmap source, int width, int height, int options)