FileDocCategorySizeDatePackage
LauncherActivity.javaAPI DocAndroid 1.5 API13916Wed May 06 22:41:54 BST 2009android.app

LauncherActivity

public abstract class LauncherActivity extends ListActivity
Displays a list of all activities which can be performed for a given intent. Launches when clicked.

Fields Summary
android.content.Intent
mIntent
android.content.pm.PackageManager
mPackageManager
Constructors Summary
Methods Summary
protected android.content.IntentgetTargetIntent()
Get the base intent to use when running {@link PackageManager#queryIntentActivities(Intent, int)}.

        return new Intent();
    
protected android.content.IntentintentForPosition(int position)
Return the actual Intent for a specific position in our {@link android.widget.ListView}.

param
position The item whose Intent to return

        ActivityAdapter adapter = (ActivityAdapter) mAdapter;
        return adapter.intentForPosition(position);
    
public java.util.ListmakeListItems()
Perform the query to determine which results to show and return a list of them.

        // Load all matching activities and sort correctly
        List<ResolveInfo> list = mPackageManager.queryIntentActivities(mIntent,
                /* no flags */ 0);
        Collections.sort(list, new ResolveInfo.DisplayNameComparator(mPackageManager));
        
        IconResizer resizer = new IconResizer();
        
        ArrayList<ListItem> result = new ArrayList<ListItem>(list.size());
        int listSize = list.size();
        for (int i = 0; i < listSize; i++) {
            ResolveInfo resolveInfo = list.get(i);
            result.add(new ListItem(mPackageManager, resolveInfo, resizer));
        }

        return result;
    
protected voidonCreate(android.os.Bundle icicle)

        super.onCreate(icicle);
        
        mPackageManager = getPackageManager();
    
        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
        setProgressBarIndeterminateVisibility(true);
        setContentView(com.android.internal.R.layout.activity_list);
        
            
        mIntent = new Intent(getTargetIntent());
        mIntent.setComponent(null);
        mAdapter = new ActivityAdapter();
        
        setListAdapter(mAdapter);
        getListView().setTextFilterEnabled(true);
        
        setProgressBarIndeterminateVisibility(false);
    
protected voidonListItemClick(android.widget.ListView l, android.view.View v, int position, long id)

        Intent intent = ((ActivityAdapter)mAdapter).intentForPosition(position);

        startActivity(intent);