user831170
user831170

Reputation:

Access and read a file inside Android project

I'm working on an Android project with multiple layers such as core,business,gui etc.

I wanna read an Application.properties file in core layer for example but when I use standart java file reading methods I access phone directories.

How can I load such a properties file that resides under com.xxx.properties package in my core layer?

Thank you.

Upvotes: 1

Views: 2948

Answers (1)

vallllll
vallllll

Reputation: 2761

You can for example have access to a file you previsously placed in the assets folder.

InputStream myInput = myContext.getAssets().open(name_of_file);

and you can use:

myInput.read();

Upvotes: 2

Related Questions