LauncherActivity


public abstract class LauncherActivity
extends ListActivity

java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.view.ContextThemeWrapper
         ↳ android.app.Activity
           ↳ android.app.ListActivity
             ↳ android.app.LauncherActivity


This class was deprecated in API level 30.
Applications can implement this UI themselves using RecyclerView and PackageManager.queryIntentActivities(Intent, int)

Displays a list of all activities which can be performed for a given intent. Launches when clicked.

Summary

Nested classes

class LauncherActivity.IconResizer

Utility class to resize icons to match default icon size. 

class LauncherActivity.ListItem

An item in the list 

Inherited constants

Inherited fields

Public constructors

LauncherActivity()

Public methods

List<LauncherActivity.ListItem> makeListItems()

Perform the query to determine which results to show and return a list of them.

void setTitle(CharSequence title)

Change the title associated with this activity.

void setTitle(int titleId)

Change the title associated with this activity.

Protected methods

Intent getTargetIntent()

Get the base intent to use when running PackageManager.queryIntentActivities(Intent, int).

Intent intentForPosition(int position)

Return the actual Intent for a specific position in our ListView.

LauncherActivity.ListItem itemForPosition(int position)

Return the ListItem for a specific position in our ListView.

void onCreate(Bundle icicle)

Called when the activity is starting.

void onListItemClick(ListView l, View v, int position, long id)

This method will be called when an item in the list is selected.

List<ResolveInfo> onQueryPackageManager(Intent queryIntent)

Perform query on package manager for list items.

void onSetContentView()

Override to call setContentView() with your own content view to customize the list layout.

Inherited methods

Public constructors

LauncherActivity

public LauncherActivity ()

Public methods

makeListItems

Added in API level 3
Deprecated in API level 30
public List<LauncherActivity.ListItem> makeListItems ()

Perform the query to determine which results to show and return a list of them.

Returns
List<LauncherActivity.ListItem>

setTitle

Added in API level 1
public void setTitle (CharSequence title)

Change the title associated with this activity. If this is a top-level activity, the title for its window will change. If it is an embedded activity, the parent can do whatever it wants with it.

Parameters
title CharSequence

setTitle

Added in API level 1
public void setTitle (int titleId)

Change the title associated with this activity. If this is a top-level activity, the title for its window will change. If it is an embedded activity, the parent can do whatever it wants with it.

Parameters
titleId int

Protected methods

getTargetIntent

Added in API level 1
protected Intent getTargetIntent ()

Get the base intent to use when running PackageManager.queryIntentActivities(Intent, int).

Returns
Intent

intentForPosition

Added in API level 3
Deprecated in API level 30
protected Intent intentForPosition (int position)

Return the actual Intent for a specific position in our ListView.

Parameters
position int: The item whose Intent to return

Returns
Intent

itemForPosition

Added in API level 4
Deprecated in API level 30
protected LauncherActivity.ListItem itemForPosition (int position)

Return the ListItem for a specific position in our ListView.

Parameters
position int: The item to return

Returns
LauncherActivity.ListItem

onCreate

Added in API level 1
protected void onCreate (Bundle icicle)

Called when the activity is starting. This is where most initialization should go: calling setContentView(int) to inflate the activity's UI, using findViewById(int) to programmatically interact with widgets in the UI, calling managedQuery(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String) to retrieve cursors for data being displayed, etc.

You can call finish() from within this function, in which case onDestroy() will be immediately called after onCreate(Bundle) without any of the rest of the activity lifecycle (onStart(), onResume(), onPause(), etc) executing.

Derived classes must call through to the super class's implementation of this method. If they do not, an exception will be thrown.


This method must be called from the main thread of your app.
If you override this method you must call through to the superclass implementation.

Parameters
icicle Bundle: If the activity is being re-initialized after previously being shut down then this Bundle contains the data it most recently supplied in Activity.onSaveInstanceState(Bundle). Note: Otherwise it is null.

onListItemClick

Added in API level 1
protected void onListItemClick (ListView l, 
                View v, 
                int position, 
                long id)

This method will be called when an item in the list is selected. Subclasses should override. Subclasses can call getListView().getItemAtPosition(position) if they need to access the data associated with the selected item.

Parameters
l ListView: The ListView where the click happened

v View: The view that was clicked within the ListView

position int: The position of the view in the list

id long: The row id of the item that was clicked

onQueryPackageManager

Added in API level 5
Deprecated in API level 30
protected List<ResolveInfo> onQueryPackageManager (Intent queryIntent)

Perform query on package manager for list items. The default implementation queries for activities.

Parameters
queryIntent Intent

Returns
List<ResolveInfo>

onSetContentView

Added in API level 5
Deprecated in API level 30
protected void onSetContentView ()

Override to call setContentView() with your own content view to customize the list layout.