1

How to play music(songs in res/raw folder in app) in my favorite music player(means it should display all players in device )if I select any player it should play on that player.and i got error after selecting the player is: an error occurred while reading the track i am not playing music please help me.

case R.id.play_button:

      Intent viewIntent = new Intent();
      viewIntent.setAction(android.content.Intent.ACTION_VIEW);
      File file = new File("file:///res/raw/sleepaway");

         // Uri uri=Uri.parse("android.resource://com.incipio.miraapp/"+ R.raw.sleepaway);

          viewIntent.setDataAndType(Uri.fromFile(file), "audio/mp3");
          Log.v("____viewi_______", "________"+viewIntent);
          //Log.v("_________uri__", "________"+uri);

           startActivityForResult(Intent.createChooser(viewIntent, ""),1);
     //  player.start();
     break;

0 Answers0