title: How to get the application name of the APK programmatically (not installed)
body: <p>Based <a href="https://stackoverflow.com/questions/7802780/how-to-get-the-name-of-the-application-in-android">How to get the name of the application in android?</a>.</p>
  
  <p>I have this snippet. `andPath| is the location of the APK.</p>
  
  <pre><code>PackageInfo info = getPackageManager().getPackageArchiveInfo(andPath, 0);
  ApplicationInfo appinfo = info.applicationInfo;
  String packageName = getPackageManager().getApplicationLabel(appinfo).toString();
  
  PackageManager pm=getPackageManager();
  ApplicationInfo ai;
  try {
       ai = pm.getApplicationInfo(packageName, 0);
  } catch (final NameNotFoundException e) {
       ai = null;
  }
  
  final String applicationName = (String) (ai != null ? pm.getApplicationLabel(ai) : "(unknown)");
  </code></pre>
  
  <p><code>applicationName</code> returns me the package name.</p>
  
  <pre><code>CharSequence c = pm.getApplicationLabel(pm.getApplicationInfo(info.processName,PackageManager.GET_META_DATA));
  </code></pre>
  
  <p><code>c</code> returns me <code>null</code>.</p>
  
  <p>Does anyone know what I'm missing here?</p>