[android-developers] reading a plain text file: java.lang.fileNotFoundException

2011-11-23 Thread John Goche
Hello, I have a really basic question. I am trying to read the contents of a plain text file from my application. I have placed the file under MyProject/assets/foo.txt and I am trying to read it in my application with BufferedReader reader = new BufferedReader(new FileReader(fileName)); reader.re

Re: [android-developers] reading a plain text file: java.lang.fileNotFoundException

2011-11-23 Thread Mark Murphy
You don't access assets/ by FileReader. You access assets/ via AssetManager, which you get from a Resources object, which you typically get via a call to getResources() on your Activity. On Wed, Nov 23, 2011 at 2:10 PM, John Goche wrote: > > Hello, > > I have a really basic question. > I am tryin

Re: [android-developers] reading a plain text file: java.lang.fileNotFoundException

2011-11-23 Thread John Goche
Thanks, Here is how I solved it, BufferedReader reader = new BufferedReader(new InputStreamReader(ctx.getAssets().open(fileName))); Regards, John Goche On Wed, Nov 23, 2011 at 8:53 PM, Mark Murphy wrote: > You don't access assets/ by FileReader. You access assets/ via > AssetManager, which yo