Bitmap is returning null from BitmapFactory.decodeFile(filename)
<p>When I am calling this function there is no image in image view 
<code>bitmapFactory.decodefile(filename)</code> showing null .. please help for this.</p>

<p>Here is my code :</p>

<pre><code>public Bitmap ShowImage(String imageName,String userImageName ) 
{

    File sdcard_mainDirectory = new File(Environment.getExternalStorageDirectory(),"UserImages").getAbsoluteFile();

    File file = new File(sdcard_mainDirectory, userImageName).getAbsoluteFile();

    if (file != null) {

        try {

            String imageInSD = "/sdcard/UserImages/"+userImageName;

            Bitmap bitmap = BitmapFactory.decodeFile(imageInSD);

            return bitmap;

        }
        catch (Exception e) {

            e.printStackTrace();
        }

    }

    return null;

}
</code></pre>
