I've a resource directory called "raw" in the "res" folder, but still can't access it through my code. The problem occurs when trying to declare the MediaPlayer variable.
public class MainActivity extends AppCompatActivity {
private MediaPlayer pSong;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
pSong = MediaPlayer.create(this,R.raw.rando);
Button playButton = (Button) findViewById(R.id.play);
playButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(MainActivity.this,"Play", Toast.LENGTH_SHORT).show();
}
});
}
}