Music app does not run on Android

Asked

Viewed 44 times

0

Hello I was creating a music app whose I hit the button touch the music, I copied all code and went to run the program not debugged on my phone and opened an error then opens a screen of the music executable from own pc and starts playing on pc the music.

images

imagem do erro e do código

imagem que mostra a musica na pasta raw mostra depois queda o erro abre a music no pc

code used

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

}

}
  • He is saying that the file name should be in low box, ie all minuscule!

  • Even though I put menuscule it gives this kind of error the bottom

1 answer

1


Hello, audio file does not accept uppercase letters or special characters, rename your file to Starboy.mp3 and test.

Run directly on mobile or via emulator

  • Thank you simple mistake lack of attention my . But mt thank you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.