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();
}
});
}
}