• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How to share the sqlite audio file to whatsapp or gmail?

Hi guys,

I am trying to share the audio file which is recorded and stored inside the app, using the SQLITE in which the path is stored. I need that audio files to shared in whats app and also attached in gmail.

So i try to copy the audio file from sqlite to internal dir. but the file is not copyed and also i did not get any errors. When it is copied , i can use that local path to share option. But i am not able to do that.

My work is to share the audio file to whatsapp and gmail.
This is audio recording app, so the audio is recorded and stored inside the app, using the sqlite DB.
I need that audio to be shared.

And i tried this code

Code:
   private void copyInputStreamToFile(File in, File file ) {

    Log.d("fnamews", " 1");

    try {
        Log.d("fnamews", "2 " );
        InputStream inStream = new FileInputStream(in);
        OutputStream out = new FileOutputStream(file);
        byte[] buf = new byte[1024];
        int len;
        while((len=inStream.read(buf))>0){
            Log.d("fnamews", "3 " );
            out.write(buf,0,len);
        }
        out.close();
        inStream.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

10wZ0.png


Can any one help me to Share the audio file to whatsapp and gmail optionn?
 
Back
Top Bottom