title: Android: Find the string resource key by the string value
body: <p>There are a lot of explanations out there in how to retrieve a string resource value by its key. But I actually need the solution for the reverse case - retrieving the key by the value instead.</p>
  
  <p>You may wonder why would I ever need something like that. Well, I got speech recognition in my app and in case there's a non-english speaker input, I need to recover the localized string key from the raw voice-to-text input so I can have multilanguage speech recognition support in my app.</p>
  
  <p>So imagine I had a string resource:</p>
  
  <pre class="lang-html prettyprint-override"><code>// EN
  &lt;string name="not_a_dog"&gt;Cat&lt;/string&gt;
  // DE
  &lt;string name="not_a_dog"&gt;Katze&lt;/string&gt;
  </code></pre>
  
  
  
  <p>So in case user says "Cat" (or "Katze" for German locale), I would get "not_a_dog".</p>