Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Environment;

public class Main {
    public static Bitmap readImageFile(String fileName) {
        if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
            return null;
        }
        File file = new File(Environment.getExternalStorageDirectory().toString() + File.separator + fileName);
        if (!file.exists()) {
            return null;
        }
        return BitmapFactory.decodeFile(fileName);
    }
}