-1

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

Unresolved reference: config

Why doesn't this compile and how to fix this?

Nexon
  • 326
  • 1
  • 11

1 Answers1

0

Remove:

import android.R

That is importing the framework's R class. You want the one that is code-generated for your own app, from your own resources.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491