Example usage for android.graphics BitmapFactory decodeFile

List of usage examples for android.graphics BitmapFactory decodeFile

Introduction

In this page you can find the example usage for android.graphics BitmapFactory decodeFile.

Prototype

public static Bitmap decodeFile(String pathName) 

Source Link

Document

Decode a file path into a bitmap.

Usage

From source file:Main.java

/**
 * Read a bitmap from a file/*from   w  w w.  j a  va  2s . com*/
 * @param filePath the full path of the bitmap
 * @return the decoded bitmap in full size
 */
public static Bitmap getBitmapFromFile(String filePath) {
    return BitmapFactory.decodeFile(filePath);
}

From source file:Main.java

public static Bitmap getBitmap(String path) {
    if (path == null) {
        return null;
    }//from  w ww.  java2  s  . co m
    File f = new File(path);
    if (f.exists()) {
        return BitmapFactory.decodeFile(f.getAbsolutePath());
    } else {
        return null;
    }

}

From source file:Main.java

public static Bitmap getNormalImages(final String path) {
    return turnPic(path, BitmapFactory.decodeFile(path));
}

From source file:Main.java

public static Bitmap getImageFromSDCard(String name) {

    String SDCarePath = Environment.getExternalStorageDirectory().toString();
    String filePath = SDCarePath;
    return BitmapFactory.decodeFile(filePath + "/" + name);
}

From source file:Main.java

public static Bitmap getBitmapFromSD(String path) {
    Bitmap bitmap = null;/*from   www. j  av  a 2s.co m*/
    try {
        File file = new File(path);
        if (file.exists()) {
            bitmap = BitmapFactory.decodeFile(path);
        }
    } catch (Exception e) {
        // TODO: handle exception
    }
    return bitmap;
}

From source file:Main.java

public static void setImage_marked_path(String path) {
    image_marked_path = path;
    image = BitmapFactory.decodeFile(image_marked_path);
}

From source file:Main.java

public static void setImage_loaded_path(String path) {
    image_loaded_path = path;
    image = BitmapFactory.decodeFile(image_loaded_path);
}

From source file:Main.java

public static Bitmap fileToBitmap(String filename) {
    try {//  w w w . jav a  2  s .c om
        File f = new File(filename);
        if (!f.exists()) {
            return null;
        }
        Bitmap tmp = BitmapFactory.decodeFile(filename);
        return tmp;
    } catch (Exception e) {
        return null;
    }
}

From source file:Main.java

public static Bitmap getBitmapFromFile(final String path) {
    if (path == null)
        return null;
    File file = new File(path);
    if (!file.exists())
        return null;
    Bitmap bm = BitmapFactory.decodeFile(path);
    return bm;/*from  w ww. j a  va  2  s .c om*/
}

From source file:Main.java

/**
 * Loads a Bitmap from a {@link File}/*from w w w  .  j av  a  2s  . c o m*/
 * 
 * @param file {@link File} to load the {@link Bitmap} from
 * @return Bitmap from the file-pointer
 */
public static Bitmap fromFile(File file) {
    return BitmapFactory.decodeFile(file.getAbsolutePath());
}