Music app does not run on Android

0

Hello, I was creating a music app whose I pressed the button, I played the song, I copied all the code and I went to run the program, it did not debug on my phone and I opened an error and then it opens a screen of its own music executable pc and start playing the music.

images

  

used code

package imperiogamerplay.music;

    import android.support.v7.app.AppCompatActivity;
    import android.media.MediaPlayer;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;


public class MainActivity extends AppCompatActivity {
Button bt;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    bt = (Button)findViewById(R.id.buttons);
    final MediaPlayer mp = MediaPlayer.create(this,R.raw.Starboy);
    bt.setOnClickListener(new View.OnClickListener(){
        @Override
        public  void  onClick(View view) {
            mp.start();
        }
    });

}

}
    
asked by anonymous 07.11.2017 / 04:58

1 answer

1

Hello, the audio file does not accept capital letters or special characters, rename your file to starboy.mp3 and test it.

Run directly on mobile or through emulator

    
07.11.2017 / 10:49