Skip to content Skip to sidebar Skip to footer

Android - Share File From Sd Using Bluetooth

Im trying to send a file from my SD using Bluetooth. I'm using Share intent, I wanna send a file from my SD (.mp3). ok when I open the share menu, I can send file to email, dropbox

Solution 1:

I think your file is not release by File-I/O.

SO.. try flush() the FileOutPutStream.. like,

fos.flush();
fos.close();

then, use Uri.fromFile(File file) for uri to pass with Intent.. But before passing Uri to Intent just check whether file is exist or not..

like,

if(newSoundFile.exist())
{
 shareIntent.putExtra(Intent.EXTRA_STREAM,Uri.fromFile(newSoundFile))
 startActivity(Intent.createChooser(shareIntent,getString(R.string.share)));
 newSoundFile.delete();
}

Post a Comment for "Android - Share File From Sd Using Bluetooth"