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
精彩评论