Android Studio – Why MediaPlayer can't be set in MainActivity?
Why when I create the MediaPlayer variable in the Main Activity, the app crashes? ( This code works fine ) public class MainActivity extends AppCompatActivity { MediaPlayer audio = MediaPlayer.create(this, R.raw.my_audio); public void play(View view){ audio.start(); } public void pause(View…