'is there possible to set a method or a variable into MediaPlayer.create()?

I'm trying to set a method or variable into the MediaPlayer.create().

I know that it is completely incorrect but the main idea is something like that

MediaPlayer.create(this, R.raw.getMelody()).

or

String melody = getMelody();

MediaPlayer.create(this, R.raw.melody);

here I want to use the word melody like a variable.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source