Android: Referring to a string resource when defining a log name
<p>In my Android app, I want to use a single variable for the log name in multiple files. At the moment, I'm specifying it separately in each file, e.g.</p>

<pre><code>public final String LOG_NAME = "LogName";
Log.d(LOG_NAME, "Logged output);
</code></pre>

<p>I've tried this:</p>

<pre><code>public final String LOG_NAME = (String) getText(R.string.app_name_nospaces);
</code></pre>

<p>And while this works in generally most of my files, Eclipse complains about one of them:</p>

<blockquote>
  <p>The method getText(int) is undefined
  for the type DatabaseManager</p>
</blockquote>

<p>I've made sure I'm definitely importing android.content.Context in that file. If I tell it exactly where to find getText:</p>

<blockquote>
  <p>Multiple markers at this line<br>
    - Cannot make a static reference to the non-static method getText(int)
  from the type      Context<br>
    - The method getText(int) is undefined for the type DatabaseManager</p>
</blockquote>

<p>I'm sure I've committed a glaringly obvious n00b error, but I just can't see it! Thanks for all help: if any other code snippets would help, let me know.</p>
