title: Android - ResourceNotFoundException for application label
body: <p>I am wondering if anyone can help me. I am getting a ResourceNotFoundException in my android application. 
  It occurs when the following code is run (the exception occurs on the <code>getString()</code> call)</p>
  
  <pre><code>        context = getApplicationContext();
          PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
          String appName = context.getString(pInfo.applicationInfo.labelRes);
  </code></pre>
  
  <p>In my <code>AndroidManifest.xml</code> I have the <code>android:label</code> attribute set for the application and activtiy tags. </p>
  
  <p>When I 
  use the debugger I can see that the <code>PackageInfo.ApplicationInfo</code> object contains value 0 for <code>labelRes</code> and that explains the exception. </p>
  
  <p>The weird thing is that the value that I set for the <code>android:label</code> attribute in <code>AndroidManifest.xml</code> is contained in the
  <code>nonLocalizedLabel</code> attribute. Does anyone know how this could happen?
  I have checked that the package name returned by the context object is the correct one for my application </p>