title: Why is my String to String comparison failing?
body: <p>I have an Android app where I want to check to see if an app name that is installed matches a string passed to the function containing this code. The code and example is below:</p>
  
  <pre><code>private Boolean checkInstalledApp(String appName){
      PackageManager pm = this.getPackageManager(); 
      Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); 
      mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); 
      List&lt;ResolveInfo&gt; list = pm.queryIntentActivities(mainIntent, 0);
      Boolean isInstalled = false;
      for(ResolveInfo info: list) {
        if (info.activityInfo.applicationInfo.loadLabel( pm ).toString()==appName){
            isInstalled = true;
            break;  
        }
      } 
  
      return isInstalled;
  }
  </code></pre>
  
  <p>Assuming you called <code>checkInstalledApp("SetCPU");</code> and the app name on the phone is called the same thing it should return <code>true</code>. However, it never does. I logged the results and it should match up but it does not. Can anyone please enlighten me as to why this doesn't work?</p>