Adding audio clip to android application is a simple task as it also add some further functionality. Here is a step by step on how to play music when App will start.
Adding Audio to app in Android Studio:
Step 1: Open the android studio with the project in which you want to add-on audio clip/media file.
Step 2: Create a raw folder.
Step 3: Add media file to raw folder by simply copy and paste that to raw folder.
Step 4: Here we added a media file “ring.mp3” . Now open the Java File of desired activity, here we are adding audio in MainActivity.
Step 5: Further add this code
MediaPlayer ring= MediaPlayer.create(MainActivity.this,R.raw.ring); ring.start();
Step 6: Now run the App and you will music will play when App will start