2011-04-06 46 views
0

我正在读取一个dictionary.png(这是一个文本文件)到一个缓冲区。 .png使android认为它是压缩的。Android - 向hashmap添加字符串

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 
      } 

我不是很熟悉HashMaps,但我想从字典中的文件读入一个哈希映射。

任何帮助,将不胜感激。

回答