is Valid Image Path - Android Graphics

Android examples for Graphics:Image File

Description

is Valid Image Path

Demo Code


//package com.java2s;

import android.graphics.BitmapFactory;

public class Main {
    public static boolean isValidImagePath(String strImagePath) {
        if (strImagePath == null) {
            return false;
        }/*from   w w  w  .ja v a 2s.c o m*/
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true;
        BitmapFactory.decodeFile(strImagePath, options);

        return (options.outMimeType != null);
    }
}

Related Tutorials