I was following this thread: Android Config File, to create an config.properties file, from which I could read. Now I have a raw folder and in it a config.properties file that I am trying to access:
res
--> raw
----> config.properties
import android.R
import android.content.Context
import android.content.res.Resources
import java.io.InputStream
import java.util.*
class ConfigurationManager(context: Context){
init {
val resources: Resources = context.resources
val rawResource: InputStream = resources.openRawResource(R.raw.config) //this doesn't work
val properties = Properties()
properties.load(rawResource)
}
}
But I get an "Unresolved reference: config" Error
Why doesn't this compile and how to fix this?