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

  • <small id='BtcIv'></small><noframes id='BtcIv'>

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

      1. 在 Android 中格式化 SD 卡

        Format SD card in Android(在 Android 中格式化 SD 卡)

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

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

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

                  本文介紹了在 Android 中格式化 SD 卡的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  事情應該很簡單,但在大多數情況下,在 Android 中并非如此.如果用戶在我的應用程序中選擇該選項,我需要格式化 SD 卡.如果它已經在操作系統中,不要問我為什么需要這樣做......不切實際,但這是我需要實現的要求.您可能知道,設置存儲擦除SD卡中有一個選項.我看了一下 froyo 源代碼,它是這樣的:

                  Things should be simple, but as most of the time, in Android, aren't. I need to format the SD card if the user selects the option in my app. Don't ask me why I need to do this if it's already in the OS... not practical but it's a requirement that I need to implement. As you may know, there is an option in Settings Storage Erase SD Card. I took a look at the froyo source code and it's something like:

                  final IMountService service =
                           IMountService.Stub.asInterface(ServiceManager.getService("mount"));
                          if (service != null) {
                              new Thread() {
                                  public void run() {
                                  try {
                                          service.formatVolume(Environment.getExternalStorageDirectory().toString());
                                      } catch (Exception e) {
                                          // Intentionally blank - there's nothing we can do here
                                      Log.w("MediaFormat", "Unable to invoke IMountService.formatMedia()");
                                      }
                                  }
                              }.start();
                          } else {
                              Log.w("MediaFormat", "Unable to locate IMountService");
                          }
                  

                  它使用 android.os.storage.IMountServiceandroid.os.ServiceManager 我似乎無法訪問它.因此,正如我所見,我可以遞歸地搜索每個文件并將其刪除,但這不合我的口味"......或者我可以從擦除 SD 卡開始屏幕給用戶.

                  It uses android.os.storage.IMountService and android.os.ServiceManager and I don't seem to have access to it. So, as I see it I could recursively search every file and delete it but that would be "not on my taste"... or I could start the screen from Erase SD card to the user.

                  任何幫助都更受歡迎,因為我被困住了.

                  Any help is more then welcome, as I am stuck.

                  推薦答案

                  我在這里找不到關于 SO 的問題,但它有一個可行的解決方案.所以所有的功勞都歸于那個人;)

                  I can't find again the question here on SO, but It had a working solution. So all credit goes to that guy ;)

                  public void wipeMemoryCard() {
                          File deleteMatchingFile = new File(Environment
                                  .getExternalStorageDirectory().toString());
                          try {
                              File[] filenames = deleteMatchingFile.listFiles();
                              if (filenames != null && filenames.length > 0) {
                                  for (File tempFile : filenames) {
                                      if (tempFile.isDirectory()) {
                                          wipeDirectory(tempFile.toString());
                                          tempFile.delete();
                                      } else {
                                          tempFile.delete();
                                      }
                                  }
                              } else {
                                  deleteMatchingFile.delete();
                              }
                          } catch (Exception e) {
                              Utils.log(e.getMessage());
                          }
                      }
                  
                      private static void wipeDirectory(String name) {
                          File directoryFile = new File(name);
                          File[] filenames = directoryFile.listFiles();
                          if (filenames != null && filenames.length > 0) {
                              for (File tempFile : filenames) {
                                  if (tempFile.isDirectory()) {
                                      wipeDirectory(tempFile.toString());
                                      tempFile.delete();
                                  } else {
                                      tempFile.delete();
                                  }
                              }
                          } else {
                              directoryFile.delete();
                          }
                      }
                  

                  這篇關于在 Android 中格式化 SD 卡的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)

                    1. <tfoot id='g4vtY'></tfoot>
                        <bdo id='g4vtY'></bdo><ul id='g4vtY'></ul>

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

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

                            <tbody id='g4vtY'></tbody>
                            主站蜘蛛池模板: 9久久婷婷国产综合精品性色 | 国产精品性做久久久久久 | 国产日韩欧美一区二区 | 中文字幕视频在线免费 | 国产精品久久久久久久久久久久久久 | jav成人av免费播放 | 黄色在线播放视频 | aacc678成免费人电影网站 | 久草网站 | 日韩精品一区二区三区中文字幕 | 亚洲高清在线观看 | 亚洲精品永久免费 | 国产精品自产av一区二区三区 | 日韩在线中文 | 中文字幕 国产 | 国产精品黄色 | 黄色网毛片| 北条麻妃国产九九九精品小说 | 欧美一区二区三区电影 | 欧美在线高清 | 91精品国产91久久久久久吃药 | 久久久噜噜噜久久中文字幕色伊伊 | 国产女人与拘做视频免费 | 午夜丰满少妇一级毛片 | 欧美日韩高清一区 | 亚洲精品乱码久久久久久按摩观 | 国产一二三视频在线观看 | 伊人免费在线 | 国产福利在线播放麻豆 | 蜜臀久久99精品久久久久野外 | 欧美中文字幕一区 | 国产区第一页 | 97精品超碰一区二区三区 | 五月激情综合网 | 国产精品视频网 | 日本不卡高字幕在线2019 | 人人人人干 | www成人免费视频 | 成人午夜免费网站 | 欧美在线精品一区 | 69精品久久久久久 |