Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8445305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:37:25+00:00 2026-06-10T09:37:25+00:00

Im trying to send a file from my SD using Bluetooth . I’m using

  • 0

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, whatsapp, but if I select Bluetooth, My device shows a message “File null was not sent to ...“

My steps are:
1. Create SEND intent.
2. Copy my file from res/raw to SD
3. Add my file to putExtra
4. Delete the file (is temporal file)

The code:

Intent shareIntent=new Intent(android.content.Intent.ACTION_SEND);
        shareIntent.setType("audio/mp3");
        //Copiamos archivo a compartir en la sd
        String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
        String fileName = sonidoActual+"-temp.mp3";

        File newSoundFile = new File(baseDir, fileName);

        try {
            byte[] readData = new byte[1024*500];
            InputStream fis = getResources().openRawResource(contexto.getResources().getIdentifier(sonidoActual,"raw", contexto.getPackageName()));
            FileOutputStream fos = new FileOutputStream(newSoundFile);
            int i = fis.read(readData);

            while (i != -1) {
                fos.write(readData, 0, i);
                i = fis.read(readData);
            }

            fos.close();
        } catch (IOException io) {
        }

        ////
        shareIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse(newSoundFile.getAbsolutePath())/*Uri.parse("file:///sdcard/"+fileName)*//*Uri.parse("android.resource://com.genaut.instantbuttonsfreak/raw/"+texto)*/);
        startActivity(Intent.createChooser(shareIntent,getString(R.string.share)));
        //
        newSoundFile.delete();

Anybody can help me with this? I read a lot but not found a working method, sorry my english.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T09:37:27+00:00Added an answer on June 10, 2026 at 9:37 am

    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();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to send back multiple variables from a php file to ajax using
I am trying to send audio file from one computer to other using socket
i am trying to send email from php i have one php file with
I am trying to send an email via GMail from ASP.Net using the code
I'm trying to send mail from my application server using the following code FILE
i am trying to send PDF file using itextsharp , the email sends fine
am trying send an array to php file using $_POST ,still always getting an
I'm trying to send form fields and file to a web service using php
I am trying to send an email that contains an attachment (a pdf file)
i couldn't send data from my device to my php file. i am trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.