Sometimes we might need to save few contents in a file and would try to access them in our android app. Say for example, you are working on an app and would like to mock your web service response, you can create a mock response (.json file) and place them in your Assets folder and access them.
The below code snippet can be used to read a file's content located at the asset folder in an android project. There is nothing fancy about it, it uses Java InputStream to read the file content and Android's Context to access file from Assets folder
The below code snippet can be used to read a file's content located at the asset folder in an android project. There is nothing fancy about it, it uses Java InputStream to read the file content and Android's Context to access file from Assets folder