久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

        <tfoot id='l4trA'></tfoot>
      1. <i id='l4trA'><tr id='l4trA'><dt id='l4trA'><q id='l4trA'><span id='l4trA'><b id='l4trA'><form id='l4trA'><ins id='l4trA'></ins><ul id='l4trA'></ul><sub id='l4trA'></sub></form><legend id='l4trA'></legend><bdo id='l4trA'><pre id='l4trA'><center id='l4trA'></center></pre></bdo></b><th id='l4trA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='l4trA'><tfoot id='l4trA'></tfoot><dl id='l4trA'><fieldset id='l4trA'></fieldset></dl></div>

        <legend id='l4trA'><style id='l4trA'><dir id='l4trA'><q id='l4trA'></q></dir></style></legend>

        <small id='l4trA'></small><noframes id='l4trA'>

        • <bdo id='l4trA'></bdo><ul id='l4trA'></ul>

        在 Android 上監聽音量變化事件

        Listen to volume changes events on Android(在 Android 上監聽音量變化事件)
          <bdo id='Yo1zX'></bdo><ul id='Yo1zX'></ul>
          <i id='Yo1zX'><tr id='Yo1zX'><dt id='Yo1zX'><q id='Yo1zX'><span id='Yo1zX'><b id='Yo1zX'><form id='Yo1zX'><ins id='Yo1zX'></ins><ul id='Yo1zX'></ul><sub id='Yo1zX'></sub></form><legend id='Yo1zX'></legend><bdo id='Yo1zX'><pre id='Yo1zX'><center id='Yo1zX'></center></pre></bdo></b><th id='Yo1zX'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Yo1zX'><tfoot id='Yo1zX'></tfoot><dl id='Yo1zX'><fieldset id='Yo1zX'></fieldset></dl></div>

            <legend id='Yo1zX'><style id='Yo1zX'><dir id='Yo1zX'><q id='Yo1zX'></q></dir></style></legend>

              <tfoot id='Yo1zX'></tfoot>

                <tbody id='Yo1zX'></tbody>
            • <small id='Yo1zX'></small><noframes id='Yo1zX'>

                  本文介紹了在 Android 上監聽音量變化事件的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  有沒有什么方法可以在 Android 上監聽音量變化的事件,而不只是接管音量按鈕?

                  Is there any way to listen to the event of volume change on Android, without just taking over the volume buttons?

                  我發現唯一有效的是 這里,但只有在音量控制消失后才能使用.

                  The only thing I've found that works is here, but it works only after the volume control has disappeared.

                  并非所有設備都有音量按鈕,我需要在音量變化發生時立即捕捉它們,而不是在音量對話框消失后捕捉.

                  Not all devices have volume buttons, and I need to capture the volume changes as soon as they occur, and not after the volume dialog is gone.

                  推薦答案

                  更好,可以注冊一個ContentObserver,如下:

                  Better, you can register a ContentObserver as follows:

                    getApplicationContext().getContentResolver().registerContentObserver(android.provider.Settings.System.CONTENT_URI, true, new ContentObserver(){...} );
                  

                  您的 ContentObserver 可能如下所示:

                  Your ContentObserver might look like this:

                  public class SettingsContentObserver extends ContentObserver {
                      private AudioManager audioManager;
                  
                      public SettingsContentObserver(Context context, Handler handler) {
                          super(handler);
                          audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
                      }
                  
                      @Override
                      public boolean deliverSelfNotifications() {
                          return false;
                      }
                  
                      @Override
                      public void onChange(boolean selfChange) {
                          int currentVolume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
                  
                          Log.d(TAG, "Volume now " + currentVolume);
                      }
                  }
                  

                  完成后:

                  getApplicationContext().getContentResolver().unregisterContentObserver(mContentObserver);
                  

                  但請注意 - 如果快速按下大量按鈕,有時通知似乎會延遲.

                  One caution, though - sometimes the notifications seem to be delayed if there are lots of button presses quickly.

                  這篇關于在 Android 上監聽音量變化事件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Get user#39;s current location using GPS(使用 GPS 獲取用戶的當前位置)
                  IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                  How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                  How to detect Location Provider ? GPS or Network Provider(如何檢測位置提供者?GPS 或網絡提供商)
                  Get current location during app launch(在應用啟動期間獲取當前位置)
                  locationManager.getLastKnownLocation() return null(locationManager.getLastKnownLocation() 返回 null)

                  <tfoot id='UNKPA'></tfoot>
                    <tbody id='UNKPA'></tbody>
                    • <i id='UNKPA'><tr id='UNKPA'><dt id='UNKPA'><q id='UNKPA'><span id='UNKPA'><b id='UNKPA'><form id='UNKPA'><ins id='UNKPA'></ins><ul id='UNKPA'></ul><sub id='UNKPA'></sub></form><legend id='UNKPA'></legend><bdo id='UNKPA'><pre id='UNKPA'><center id='UNKPA'></center></pre></bdo></b><th id='UNKPA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='UNKPA'><tfoot id='UNKPA'></tfoot><dl id='UNKPA'><fieldset id='UNKPA'></fieldset></dl></div>

                        • <bdo id='UNKPA'></bdo><ul id='UNKPA'></ul>

                            <legend id='UNKPA'><style id='UNKPA'><dir id='UNKPA'><q id='UNKPA'></q></dir></style></legend>

                            <small id='UNKPA'></small><noframes id='UNKPA'>

                            主站蜘蛛池模板: 欧美成人自拍 | 久久伊人精品一区二区三区 | a国产视频 | 国产日韩一区二区 | 国产精品一区二区在线 | 日韩欧美中文字幕在线观看 | 免费a在线 | 欧美视频区 | 精品一区免费 | 色.com| 涩爱av一区二区三区 | 免费性视频 | 国产精品欧美一区二区三区 | 91精品一区二区三区久久久久久 | 午夜影院 | 亚洲视频免费 | 国产一区二区三区 | 国产成人a亚洲精品 | 久久精品青青大伊人av | 日韩在线小视频 | 亚洲小视频在线播放 | 成人免费看 | 日本不卡一区二区三区在线观看 | 91亚洲国产成人久久精品网站 | 国产在线高清 | 欧美在线一区二区三区 | 成人午夜免费在线视频 | 亚洲一区中文字幕 | 欧美二区在线 | 尹人av | 欧美日韩综合 | 超碰人人做| 欧美午夜精品 | 欧美爱爱视频 | 91香蕉嫩草 | 亚洲一区高清 | 日韩在线一区二区 | 欧美精品在线免费观看 | 久久欧美高清二区三区 | 亚洲午夜精品一区二区三区 | 国产一区二区欧美 |