title: What can I do to list activities instead of package name in my code?
body: <p>I am using the following code to list all installed activities but instead of showing the app name it shows the name like com.xyz.xyz.dialer
  I want it to show app name only. Where do I need to change and to what?</p>
  
  <pre><code>public class AppPicker extends ListActivity{
  
  // Buffer used to store package and class information, and also determine the number of installed activities
  private ArrayList&lt;String[]&gt; _activitiesBuffer = null;
  
  // Buffers for package and class information
  private String[] _packages = null;
  private String[] _classes = null;
  
  // Index used to fill buffers
  private int _index = 0;
  
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      // Get all installed activities (package and class information for every activity)
      getAllInstalledActivities();              
  
      // Set content to GUI
      setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.list_item, _classes));
  
      ListView lv = getListView();
      lv.setTextFilterEnabled(true);
  
      // Add listener
      lv.setOnItemClickListener(new OnItemClickListener() {
  
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
              // When clicked, show a toast with the selected activity
              Toast.makeText(
                  getApplicationContext(), 
                  ((TextView) view).getText(), 
                  Toast.LENGTH_SHORT).show();
  
              // When clicked, start selected activity, if allowed or possible
              try {
  
                  Intent intent = new Intent().setClassName(
                          _packages[position], // package 
                          _classes[position]); // class
                  startActivity(intent);
  
              } catch (Exception e) {
                  e.printStackTrace();
              }
  
        } // public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id)
  
      });
  
  } // public void onCreate(Bundle savedInstanceState)
  </code></pre>
  
  <p>This is the getInstalledActivities method. I have seperated it here for easy access.</p>
  
  <pre><code>   /*
   * Get all installed activities
   */
  private void getAllInstalledActivities() {
  
      // Initialize activities buffer
      _activitiesBuffer = new ArrayList&lt;String[]&gt;();
  
      final Intent intent = new Intent(Intent.ACTION_MAIN, null);
      intent.addCategory(Intent.CATEGORY_LAUNCHER);
      final List&lt;ResolveInfo&gt; pkgAppsList = getPackageManager().queryIntentActivities( intent, 0);
  
      Iterator&lt;ResolveInfo&gt; iterator1 = pkgAppsList.iterator();
      while (iterator1.hasNext()) {
  
          ResolveInfo resolveInfo = iterator1.next();
  
          String[] buf = new String[] {
                  resolveInfo.activityInfo.packageName, 
                  resolveInfo.activityInfo.name};
  
          _activitiesBuffer.add(buf);
  
      } // while (iterator1.hasNext())
  
      _packages = new String[_activitiesBuffer.size()];
      _classes = new String[_activitiesBuffer.size()];
  
      Iterator&lt;String[]&gt; iterator2 = _activitiesBuffer.iterator();
      while (iterator2.hasNext()) {
  
          String[] buf = iterator2.next();
  
          // Store package information
          _packages[_index] = buf[0]; 
  
          // Store class information
          _classes[_index] = buf[1];
  
          _index++;
  
      } // while (iterator2.hasNext())
  
  } // private void getAllInstalledActivities()    
  </code></pre>