Copying resource file to external storage on android not working -
I am working on an intermediate application and trying some default songs, if the user does not have their phones There is no one (I am pulling lists of genuine songs through mediators).
Then I have songs placed in the race / raw folder and the following code is fun to copy them. It seems that is being copied properly (because the Astro File Browser and other apps see them properly) but the arbitrator is still unable to find them.
I think there is something with permissions on this file, but I'm not sure what happened. Anyone know why? "When you add files to android filesystem ... If you want to add your files to the Media Library, then you can do this either by using the MediaStore content provider, or by using MediaCane. " You can add them by sending a broadcast: () InputStream Songs = getResources (). OpenRawResource (R.raw.aquarel); File file = new file (environment GateInstinestorporical Directory (environment. DIRECTORY_MUSIC), "aquarel.mp3"); Logs. A (tag, "file1:" + file.getPath ()); Outputstream copy = new file optup stream (file); Byte [] buffer = new byte [1024]; Int readvalue = 0; readvalue = song.read (buffer); While (Watch> gt; 0) {copySong.write (buffer, 0, pendavu); Readvalue = song.read (buffer); } CopySong.close ();
intended intent = new intent (int. action_md_s_snsnasnaini) ;; intent.setData (Uri.fromFile (file)); SendBroadcast;
Comments
Post a Comment