久久久久久久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 卡的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  事情應(yīng)該很簡單,但在大多數(shù)情況下,在 Android 中并非如此.如果用戶在我的應(yīng)用程序中選擇該選項(xiàng),我需要格式化 SD 卡.如果它已經(jīng)在操作系統(tǒng)中,不要問我為什么需要這樣做......不切實(shí)際,但這是我需要實(shí)現(xiàn)的要求.您可能知道,設(shè)置存儲擦除SD卡中有一個選項(xiàng).我看了一下 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.

                  任何幫助都更受歡迎,因?yàn)槲冶焕ё×?

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

                  推薦答案

                  我在這里找不到關(guān)于 SO 的問題,但它有一個可行的解決方案.所以所有的功勞都?xì)w于那個人;)

                  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();
                          }
                      }
                  

                  這篇關(guān)于在 Android 中格式化 SD 卡的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Get user#39;s current location using GPS(使用 GPS 獲取用戶的當(dāng)前位置)
                  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 或網(wǎng)絡(luò)提供商)
                  Get current location during app launch(在應(yīng)用啟動期間獲取當(dāng)前位置)
                  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>
                            主站蜘蛛池模板: 影音先锋亚洲资源 | 亚洲精品国产成人 | 免费黄色的视频 | 99精品国自产在线观看 | 日韩一区二区三区精品 | 亚洲一区二区三区久久 | 国产激情91久久精品导航 | 毛片a区| .国产精品成人自产拍在线观看6 | 欧美欧美欧美 | 亚洲国产二区 | 男女羞羞视频在线免费观看 | 精品国产黄色片 | 古典武侠第一页久久777 | 日韩av在线免费 | 国产精品久久国产精品久久 | 91视频大全| 久久久久久av | 老熟女毛片 | 龙珠z国语版在线观看 | av色站| 午夜影院在线播放 | 中文字幕亚洲区 | 一区二区免费高清视频 | 国产免费又色又爽又黄在线观看 | 超碰人人在线 | 国产精品视频一二三区 | 亚洲高清视频一区 | 国产一区二区影院 | 特黄一级| 国产成人精品一区二区三区网站观看 | 黄色毛片在线播放 | 久久一区二区视频 | 成人性视频在线播放 | 男女性毛片 | 在线日韩| 一区二区三区在线免费观看视频 | 日本免费一区二区三区 | 国产精品99久久久久久动医院 | 久久乐国产精品 | 欧美激情一区二区 |