I'm kind of new to android java so I started to create a Music Player app just to learn and practice. The main thing was to control the same MediaPlayer from 2 different activities (In MainActivity there's a listview with the music files and PlayerActivity has the MediaPlayer). I tried to use public voids like:
PlayerActivity pa = new PlayerActivity();
//button onClick
pa.songPlay();
and it kind of worked at first but then a lot of errors occurred when using contexts and MediaPlayer.create(), so I started to look for another way to do this but found none so far. Is there a way to make 2 different layouts with a shared element, and with the same class?
For a better explanation:


