开发者

getResources / OpenRawSource causing runtime exception

I want to read from a text file. In a Java app, this

BufferedReader f = new BufferedReader(new FileReader(filename));

works, in Android I tried

BufferedReader f = new BufferedReader (new InputStreamReader(getResources().openRawResource(R.raw.autobahnnetz_gps))) ;

which crashes the app. If I use this in the main activity class, it works fine. So I guess I have to pass the context to getResources by

getApplicationContext().getResources

but that doesnt work eithe开发者_运维技巧r.

What am I missing here?


ya this problem is exist, but i am able to find one work around see this

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜