• <sub id="h4knl"><ol id="h4knl"></ol></sub>
    <sup id="h4knl"></sup>
      <sub id="h4knl"></sub>

      <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
      1. <strong id="h4knl"></strong>

      2. Android讀取本地json文件的方法

        時間:2024-07-06 22:46:52 JSON 我要投稿
        • 相關(guān)推薦

        Android讀取本地json文件的方法

          本文實例講述了Android讀取本地json文件的方法。分享給大家供大家參考,具體如下:

          1、讀取本地JSON ,但是顯示漢字亂碼

          public static String readLocalJson(Context context, String fileName){ String jsonString=""; String resultString=""; try { BufferedReader bufferedReader=new BufferedReader(new InputStreamReader( context.getResources().getAssets().open(fileName))); while ((jsonString=bufferedReader.readLine())!=null) { resultString+=jsonString; } } catch (Exception e) { // TODO: handle exception } return resultString;}

          2、讀取本地JSON,顯示漢字正確,txt文件設(shè)置時UTF-8,UNIX

          public static String readLocalJson(Context context, String fileName){ String jsonString=""; String resultString=""; try { InputStream inputStream=context.getResources().getAssets().open(fileName); byte[] buffer=new byte[inputStream.available()]; inputStream.read(buffer); resultString=new String(buffer,"GB2312"); } catch (Exception e) { // TODO: handle exception } return resultString;}

        【Android讀取本地json文件的方法】相關(guān)文章:

        隱藏電腦文件的方法03-19

        excel合并多個文件的方法05-27

        壓縮視頻文件的方法03-20

        配置本地路由的常見方法介紹03-03

        Node.js如何響應(yīng)Ajax的POST請求并且保存為JSON文件詳解03-29

        iphone和電腦傳文件的方法03-21

        word 恢復(fù)未保存文件的方法01-04

        mac給文件夾加密的方法03-12

        解決本地連接故障的三個方法03-06

        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码
      3. <sub id="h4knl"><ol id="h4knl"></ol></sub>
        <sup id="h4knl"></sup>
          <sub id="h4knl"></sub>

          <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
          1. <strong id="h4knl"></strong>

          2. 亚洲中文在线精品国产 | 日本午夜视频免费 | 亚洲精品欧洲精品乱码不卡 | 在线播放国产熟睡乱子伦 | 在线视频一区二区三区不卡 | 夜夜夜夜夜国产区 |