title: How to assign string resource to kotlin value without getting error
body: <p>I have value inside my code:</p>
  
  <pre><code>val mainFileName = "Untitled list"
  </code></pre>
  
  <p>As I know the best way to handle strings is using string resource, so inside String resource file I created this string:</p>
  
  <p><code>&lt;string name="untitled_list"&gt;Untitled list&lt;/string&gt;</code></p>
  
  <p>In order to test if i done everything right, I tested that string on toast and everything is working fine:</p>
  
  <pre><code>Toast.makeText(this, R.string.untitled_list,Toast.LENGTH_SHORT).show()
  </code></pre>
  
  <p>Then I tried to assign to "mainFileName" that string resource by doing this (inside MainActivity class but outside of method OnCreate):</p>
  
  <pre><code>val previewOfNewListTitle = resources.getString(R.string.untitled_list)
  </code></pre>
  
  <p>but I get an error:</p>
  
  <pre><code>     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
      at android.content.ContextWrapper.getResources(ContextWrapper.java:91)
      at android.view.ContextThemeWrapper.getResourcesInternal(ContextThemeWrapper.java:127)
      at android.view.ContextThemeWrapper.getResources(ContextThemeWrapper.java:121)
      at android.support.v7.app.AppCompatActivity.getResources(AppCompatActivity.java:543)
      at lt.tetro.myapplication.MainActivity.&lt;init&gt;(MainActivity.kt:121)
  </code></pre>
  
  <p>How can I assign string resource text to "mainFileName" inside of MainActivity class?</p>