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

  • <legend id='A9qpi'><style id='A9qpi'><dir id='A9qpi'><q id='A9qpi'></q></dir></style></legend>
    1. <small id='A9qpi'></small><noframes id='A9qpi'>

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

          <bdo id='A9qpi'></bdo><ul id='A9qpi'></ul>

        數(shù)據(jù)目錄在Android中沒有讀/寫權限

        Data directory has no read/write permission in Android(數(shù)據(jù)目錄在Android中沒有讀/寫權限)

          1. <small id='52lTW'></small><noframes id='52lTW'>

            <legend id='52lTW'><style id='52lTW'><dir id='52lTW'><q id='52lTW'></q></dir></style></legend>
            • <bdo id='52lTW'></bdo><ul id='52lTW'></ul>
                  <tbody id='52lTW'></tbody>
                <tfoot id='52lTW'></tfoot>
                • <i id='52lTW'><tr id='52lTW'><dt id='52lTW'><q id='52lTW'><span id='52lTW'><b id='52lTW'><form id='52lTW'><ins id='52lTW'></ins><ul id='52lTW'></ul><sub id='52lTW'></sub></form><legend id='52lTW'></legend><bdo id='52lTW'><pre id='52lTW'><center id='52lTW'></center></pre></bdo></b><th id='52lTW'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='52lTW'><tfoot id='52lTW'></tfoot><dl id='52lTW'><fieldset id='52lTW'></fieldset></dl></div>
                  本文介紹了數(shù)據(jù)目錄在Android中沒有讀/寫權限的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我使用的是 Android 1.5 我的數(shù)據(jù)目錄沒有讀/寫權限

                  I m using Android 1.5 my data directory doesn't have the read/write permissions

                  System.out.println("DAta can write??--->"+Environment.getDataDirectory().canWrite());
                  System.out.println("DAta can read??--->"+Environment.getDataDirectory().canRead());
                  

                  所以請建議我如何為數(shù)據(jù)目錄提供權限.

                  So please suggest me how to provide permissions for the data directory.

                  我要做的是創(chuàng)建一個文件并在模擬器的數(shù)據(jù)存儲中添加一些內(nèi)容,如下所示

                  What I'm trying to do is to create a file and add some content to it in the Data storage of the emulator like as below

                  private void writeToSDCard() {
                          try {
                  
                              File lroot = Environment.getDataDirectory();
                  
                              if (lroot.canWrite()){
                                  File lfile = new File(lroot, "samplefile.txt");
                                  FileWriter lfilewriter = new FileWriter(lfile);
                                  BufferedWriter lout = new BufferedWriter(lfilewriter);
                                  lout.write("XXXXXXXXXXXXXXXXXX");
                                  lout.close();
                              }
                          } catch (IOException e) {
                              Log.e(m_cTAG, "Could not write file " + e.getMessage());
                          }
                      }
                  

                  推薦答案

                  您不應該查看數(shù)據(jù)目錄.這是手機存儲中的系統(tǒng)目錄 - 通常是 /data - 您的應用程序永遠不會有寫入權限.

                  You shouldn't be looking at the Data Directory. This is a system directory in the phone's storage - usually /data - and your application will never have permission to write to it.

                  您的應用程序應該寫入文件的目錄由 返回Context.getFilesDir() 方法.它將類似于 /data/data/com.yourdomain.YourApp/files.

                  The directory your application should write files to is returned by the Context.getFilesDir() method. It will be something like /data/data/com.yourdomain.YourApp/files.

                  如果您想寫入手機存儲中的文件,請使用 Context.openFileOutput() 方法.

                  If you want to write to a file in the phone's storage use the Context.openFileOutput() method.

                  如果您想要 SDCard 的路徑,請使用 Environment.getExternalStorageDirectory() 方法.要寫入 SDCard,您需要通過將以下內(nèi)容添加到您的 Manifest 來為您的應用程序授予適當?shù)臋嘞?

                  If you want the path to the SDCard then use Environment.getExternalStorageDirectory() method. To write to the SDCard you'll need to give your application the appropriate permissions by adding the following to your Manifest:

                  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
                  

                  如果您要寫入 SDCard,您還需要使用 getExternalStorageState() 方法檢查其狀態(tài).

                  If you're going to write to the SDCard you'll also need to check its state with the getExternalStorageState() method.

                  如果您要存儲與應用程序相關的小文件,那么這些文件可以進入手機的存儲空間而不是 SD 卡,因此請使用 Context.openFileOutput()Context.openFileInput() 方法.

                  If you're storing small files to do with your application then these can go into the phone's storage and not the SD Card, so use the Context.openFileOutput() and Context.openFileInput() methods.

                  所以在您的代碼中考慮如下內(nèi)容:

                  So in your code consider something like:

                  OutputStream os = openFileOutput("samplefile.txt", MODE_PRIVATE);
                  BufferedWriter lout = new BufferedWriter(new OutputStreamWriter(os));
                  

                  這篇關于數(shù)據(jù)目錄在Android中沒有讀/寫權限的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關文檔推薦

                  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 或網(wǎng)絡提供商)
                  Get current location during app launch(在應用啟動期間獲取當前位置)
                  locationManager.getLastKnownLocation() return null(locationManager.getLastKnownLocation() 返回 null)

                  • <legend id='R5hWA'><style id='R5hWA'><dir id='R5hWA'><q id='R5hWA'></q></dir></style></legend>

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

                            <tbody id='R5hWA'></tbody>
                            <bdo id='R5hWA'></bdo><ul id='R5hWA'></ul>

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

                            主站蜘蛛池模板: 精品一区二区在线看 | 中文字幕高清免费日韩视频在线 | a级片网站 | 久久久91精品国产一区二区三区 | 97色在线观看免费视频 | 久久久国产一区 | 亚洲精品v日韩精品 | 在线观看www | 国际精品鲁一鲁一区二区小说 | 亚洲夜夜爽| 久久久久久久久久久久久久久久久久久久 | av毛片| 欧美在线精品一区 | 色天堂视频 | 午夜视频在线免费观看 | 99视频在线| 成人不卡视频 | 91视频在线 | 亚洲精品一区二区在线观看 | 久久一本 | 一区二区三区视频在线 | 久久精品久久久久久 | 人人人干| 国产成在线观看免费视频 | 毛片在线看片 | 国产精品视频一区二区三 | 国产乱码精品一区二区三区中文 | 亚洲成人精品一区二区 | 一区二区三区国产在线观看 | 国产精品www | 国产精品免费看 | 午夜看电影在线观看 | 国产精品一区在线观看你懂的 | 一区影院 | 国产91av视频在线观看 | 毛片区| 久久久久久久久99 | 美女在线观看国产 | 成人国产精品久久 | 91精品国产综合久久婷婷香蕉 | 一区二区三区四区电影视频在线观看 |