【问题标题】:Android - Adding strings to hashmapAndroid - 将字符串添加到 hashmap
【发布时间】:2011-07-30 10:24:59
【问题描述】:

我目前正在将一个 dictionary.png(它是一个文本文件)读入缓冲区。 .png 让 android 认为它是压缩的。

InputStream is = getResources().openRawResource(R.raw.dictionary);
            try {
            BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF8"));
            String next;
            while ((next = br.readLine()) != null) {
            //Add the string next to a map or whatever

            }
            } catch (Exception e) {
            //Something nasty happened
            }

我对@9​​87654322@ 不是很熟悉,但我想将字典中的文件读入哈希映射。

任何帮助将不胜感激。

【问题讨论】:

    标签: android string hashmap buffer


    【解决方案1】:

    与您所询问的内容类似的示例:Using HashMap to map a String and int

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-13
      相关资源
      最近更新 更多