开发者

Android - Adding strings to hashmap

I am currently reading a dictionary.png (which is a text file) into a buffer. .png to make android think it is compressed.

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
            }

i'm not very familiar with HashMaps but i want to read the files from the dictionary into a hash map.

Any help would be appreciated.


An example that does something similar to what you're asking about: Using HashMap to map a String and int

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜