Code Cleanup
This commit is contained in:
parent
4b4232ce6b
commit
b143419520
4 changed files with 4 additions and 16 deletions
|
@ -16,6 +16,7 @@ package code.name.monkey.retromusic.volume
|
|||
import android.content.Context
|
||||
import android.media.AudioManager
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.provider.Settings
|
||||
import androidx.core.content.getSystemService
|
||||
|
||||
|
@ -25,7 +26,7 @@ class AudioVolumeObserver(private val context: Context) {
|
|||
private var contentObserver: AudioVolumeContentObserver? = null
|
||||
|
||||
fun register(audioStreamType: Int, listener: OnAudioVolumeChangedListener) {
|
||||
val handler = Handler()
|
||||
val handler = Handler(Looper.getMainLooper())
|
||||
// with this handler AudioVolumeContentObserver#onChange()
|
||||
// will be executed in the main thread
|
||||
// To execute in another thread you can use a Looper
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue