Android draw bitmap on canvas from pictures directory
<p>Using the following code to load a jpg into a bitmap and draw it on a canvas</p>

<pre><code>File extStore = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
        File myFile = new File(extStore.getAbsolutePath() + "/MyPicture.jpg");

        if(myFile.exists()){
            Toast.makeText(getBaseContext(),"yes",Toast.LENGTH_LONG).show();
        }


        Bitmap b1 = BitmapFactory.decodeFile(myFile.toString());
        canvas.drawBitmap (b1, 0,  0, null);
</code></pre>

<p>The App crashes with 2 errors</p>

<p>BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/Pictures/MyPicture.jpg: open failed: EACCES (Permission denied)</p>

<p>and  further down it says</p>

<p>java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.isRecycled()' on a null object reference</p>

<p>I have permissions set in manaifest as follows</p>

<pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
&lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
</code></pre>

<p>App is targeting API 19 so shouldnt matter</p>

<p>The check to see if the file exist works so it is the correct location</p>

<p>It just wont work any ideas where im going wrong</p>

<p>Thanks in advance</p>

<p>Mark</p>