Android-向hashmap添加字符串
我目前正在将dictionary.png(一个文本文件)读入缓冲区。 .png使android认为它是压缩的Android-向hashmap添加字符串,android,string,hashmap,buffer,Android,String,Hashmap,Buffer,我目前正在将dictionary.png(一个文本文件)读入缓冲区。 .png使android认为它是压缩的 InputStream is = getResources().openRawResource(R.raw.dictionary); try { BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF8")); String next
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
}
我不太熟悉哈希映射
,但我想将字典中的文件读入哈希映射
任何帮助都将不胜感激。一个与您所问内容类似的示例: