I'm thinking about putting a .txt
file in res/drawable
or in res/layout
to have it in t开发者_如何学JAVAhe 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.
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.
精彩评论