get Image From Local - Android Graphics

Android examples for Graphics:Image File

Description

get Image From Local

Demo Code


//package com.java2s;

import java.io.File;

import android.graphics.Bitmap;

import android.graphics.BitmapFactory;

public class Main {

    public static Bitmap getImageFromLocal(String imagePath) {
        File file = new File(imagePath);
        if (file.exists()) {
            Bitmap bitmap = BitmapFactory.decodeFile(imagePath);
            file.setLastModified(System.currentTimeMillis());
            return bitmap;
        }/*from ww  w.j ava  2  s  . c o  m*/
        return null;
    }
}

Related Tutorials