I have tried using this code, but I keep getting a nullpointedexception at
FileInputStream fis = soundFile.createInputStream();
I have added permissions, but the error is still there?
if you code is the same as
try {
soundFile= mCr.openAssetFileDescriptor(mUri, "r");
} catch (FileNotFoundException e) {
soundFile=null;
}
try {
byte[] readData = new byte[1024];
FileInputStream fis = soundFile.createInputStream();
then what is probably happening is that
mCr.openAssetFileDescriptor(mUri, "r");
is either returning null or triggering an exception.
I would:
1) add some logs to trace exactly where the problem is
2) check that you have all the permissions
3) check that the file you are trying to open exist and is at the right location
if that fails come back here with some logs and we'll help more ;)