I just started to use Android Studio. I don\'t know where to put my own properties file since there is no assets folder in the project structure.
The posted snippet
You can create your asset subfolder in your main folder and then insert the .properties file in it.
Then, create a class to open and read the file, for example:
public class PropertiesReader {
private Context context;
private Properties properties;
public PropertiesReader(Context context) {
this.context = context;
//creates a new object ‘Properties’
properties = new Properties();
public Properties getProperties(String FileName) {
try {
//access to the folder ‘assets’
AssetManager am = context.getAssets();
//opening the file
InputStream inputStream = am.open(FileName);
//loading of the properties
properties.load(inputStream);
}
catch (IOException e) {
Log.e("PropertiesReader",e.toString());
}
}
return properties;
}
}
For more information, see http://pillsfromtheweb.blogspot.it/2014/09/properties-file-in-android.html