java.nio.channels.NonWritableChannelException when try to get backup apk file
<p>I want to get backup installed apk. by using H<a href="http://stackoverflow.com/questions/8307034/how-to-get-the-apk-file-of-an-application-programatically">ow to get the .apk file of an application programatically</a> and I get the apk File. and when I try to take backup to another file I get</p>

<pre><code>Caused by: java.nio.channels.NonWritableChannelException
</code></pre>

<p>code to get backup the file:</p>

<pre><code>File sourceFile = new File(app.publicSourceDir);
File backupFile = new File(Environment.getExternalStorageDirectory(), "SoundRecorder.apk");
if(!backupFile.exists())
     backupFile.createNewFile();
     if(sourceFile.exists()) {
         FileChannel src = new FileInputStream(sourceFile).getChannel();
         FileChannel dst = new FileInputStream(backupFile).getChannel();
         dst.transferFrom(src, 0, src.size());  &lt;--here I get the exception
         src.close();
         dst.close();
     }
</code></pre>

<p>I write android.permission.WRITE_EXTERNAL_STORAGE in manifest.xml also.</p>
