Not able to achieve Gapless audio looping so far on Android

From the test that I have done, this solution works fine, over 150 loops with a 13 seconds 160 kbps MP3 without any problem: public class LoopMediaPlayer { public static final String TAG = LoopMediaPlayer.class.getSimpleName(); private Context mContext = null; private int mResId = 0; private int mCounter = 1; private MediaPlayer mCurrentPlayer = null; … Read more

Using SeekBar to Control Volume in android?

Please look at below code . It solves your problem. import android.app.Activity; import android.content.Context; import android.media.AudioManager; import android.os.Bundle; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; public class TestExample extends Activity { /** Called when the activity is first created. */ private SeekBar volumeSeekbar = null; private AudioManager audioManager = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setVolumeControlStream(AudioManager.STREAM_MUSIC); … Read more

How do you get/set media volume (not ringtone volume) in Android?

private AudioManager audio; Inside onCreate: audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE); Override onKeyDown: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI); return true; case KeyEvent.KEYCODE_VOLUME_DOWN: audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI); return true; default: return false; } }

Change Media volume in Android?

The right method to use would be setStreamVolume on your AudioManager. It could looks like this AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE); audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, [int value], [if desired a flag]); An example use of the flag is to get the beep when setting the volume so the user can hear the outcome. The flag for that would be … Read more

In Android 7 (API level 24) my app is not allowed to mute phone (set ringer mode to silent)

Thanks for your answers, here is a little more detail. To be able to set ringer mode to silent, you must ask permission to access notification policy (like @ucsunil said). <uses-permission android:name=”android.permission.ACCESS_NOTIFICATION_POLICY” /> Then, check if you have this permission. If you do not, open the settings for “Do Not Disturb access” for your app: … Read more