about the params Set what to make the player no sound and full sound
Thanks
You can't destroy one activity from another activity. But you can pause the media player by creating a new instance of MediaPlayer in the second activity and callind the 'stop' method !
The feature is as simple as tapping and holding on the media card of any app then choosing Dismiss.
MediaPlayer Class in Android is used to play media files. Those are Audio and Video files. It can also be used to play audio or video streams over the network.
A redesigned media player One of the more obvious upgrades you'll see on Android 13, is a redesigned media player widget. It shows up under Quick Settings and on the lock screen when media is playing.
This function is actualy wonderful. Thanks to it you can create a volume scale with any number of steps!
Let's assume you want 50 steps:
int maxVolume = 50;
Then to set setVolume to any value in this range (0-49) you do this:
float log1=(float)(Math.log(maxVolume-currVolume)/Math.log(maxVolume)); yourMediaPlayer.setVolume(log1,log1); //set volume takes two paramater
Nice and easy! And DON'T use AudioManager to set volume! It will cause many side effects such as disabling silent mode, which will make your users mad!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With