Thanks Mark

I have tried the approach mentioned by you and it worked.

Thanks
Dalvin

On Sun, Apr 24, 2011 at 8:53 PM, Mark Murphy <[email protected]>wrote:

> On Sun, Apr 24, 2011 at 11:17 AM, Dalvin <[email protected]> wrote:
> > I am trying to read a simple text file in my sample Android Application.
> I
> > am using the below written code for reading the simple text file.
> > 1. InputStream inputStream = openFileInput("test.txt");
> > 2. InputStreamReader inputStreamReader = new
> InputStreamReader(inputStream);
> > 3. BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
> > My questions is :
> > Where should I place this "test.txt" file in my project.
>
> It does not go in your project.
>
> > I have tried
> > putting the file under "res/raw" and "asset" folder but I get the
> exception
> > "FileNotFound" when first live of the code written above gets executed.
>
> Of course.
>
> If you want to read a raw resource, use getResources().openRawResource().
>
> If you want to read an asset, use getResources().getAssets().open().
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android 3.0 Programming Books: http://commonsware.com/books
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to