簡體   English   中英

"當我嘗試從資產文件夾內的文本文件(.txt)中讀取值時,“文件名必須以 .xml 結尾”"

[英]'The file name must end with .xml' when i try to read the value from text file(.txt) inside the assets folder

我正在嘗試從assets文件夾內的文本文件(.txt)中讀取值,當我嘗試重建項目時,出現此錯誤,如何解決?

The file name must end with .xml

這是java代碼,我正在嘗試從文本文件中讀取值,

         try {

            InputStream is=getAssets().open("english.text");
            int size=is.available();

            byte[] buffer=new byte[size];
            is.read(buffer);
            is.close();
            line=new String(buffer);

        } catch (IOException e) {
            e.printStackTrace();
        }

圖像

您將assets\/<\/code>目錄放在錯誤的位置。 它需要直接在main\/<\/code>下,作為java\/<\/code>和res\/<\/code>的對等點。

"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM