Rename URI file to share audio from raw folder

0

I'm trying to make an app with sound-sharing that is inside the application's "raw" folder, but I'm not getting it. The file is shared, but it does not have the extension .mp3 .

I was able to listen in windows media player, but I had to put the .mp3 extension manually.

Does anyone have any idea how I can automatically extend .mp3 extension? Transform / Rename URI into mp3 file.

The name of the song comes as what is registered in the file, I believe that if I can rename it by adding .mp3 in the end it can work. But I'm not able to rename.

I'm using this code:

Intent share;

Uri 
 uri = Uri.parse("android.resource://"+this.getPackageName()+"/raw/nome_da_musica");
            share = new Intent(Intent.ACTION_SEND);           
            share.putExtra(Intent.EXTRA_STREAM, uri);
            share.setType("audio/*");
            share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
            startActivity(Intent.createChooser(share, "Enviar via: "));
    
asked by anonymous 08.03.2018 / 15:15

0 answers