tags:

views:

37

answers:

1

Hi

I'm thinking at putting a .txt file in res/drawable or in res/layout to have it in the apk when the application is packed, and then after install to open and read from it to perform some tasks . Can this be done ? If yes please let me know how can I access the file ,as I don't know it's path .

+4  A: 

A .txt file is neither a drawable nor a layout. You should put it in res/raw. You can get access to it like:

    Resources resources = this.getResources(); 
    InputStream is = resources.openRawResource(R.raw.yourtextfile);

Try/catch and errorhandling omited in above code.

Maurits Rijk