Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/view/View.OnCreateContextMenuListener#pubmethods)

# View.OnCreateContextMenuListener

*** ** * ** ***

` public static interface View.OnCreateContextMenuListener `   
` `

|---|
| android.view.View.OnCreateContextMenuListener |

Known indirect subclasses [AccountAuthenticatorActivity](https://developer.android.com/reference/android/accounts/AccountAuthenticatorActivity), [Activity](https://developer.android.com/reference/android/app/Activity), [ActivityGroup](https://developer.android.com/reference/android/app/ActivityGroup), [AlertDialog](https://developer.android.com/reference/android/app/AlertDialog), [AliasActivity](https://developer.android.com/reference/android/app/AliasActivity), [CharacterPickerDialog](https://developer.android.com/reference/android/text/method/CharacterPickerDialog), [DatePickerDialog](https://developer.android.com/reference/android/app/DatePickerDialog), [Dialog](https://developer.android.com/reference/android/app/Dialog), [DialogFragment](https://developer.android.com/reference/android/app/DialogFragment), [ExpandableListActivity](https://developer.android.com/reference/android/app/ExpandableListActivity), [Fragment](https://developer.android.com/reference/android/app/Fragment), [LauncherActivity](https://developer.android.com/reference/android/app/LauncherActivity), [ListActivity](https://developer.android.com/reference/android/app/ListActivity), [ListFragment](https://developer.android.com/reference/android/app/ListFragment), [NativeActivity](https://developer.android.com/reference/android/app/NativeActivity), and 7 others. [AccountAuthenticatorActivity](https://developer.android.com/reference/android/accounts/AccountAuthenticatorActivity) *This class was deprecated in API level 30. Applications should extend Activity themselves. This class is not compatible with AppCompat, and the functionality it provides is not complex.* [Activity](https://developer.android.com/reference/android/app/Activity) An activity is a single, focused thing that the user can do. [ActivityGroup](https://developer.android.com/reference/android/app/ActivityGroup) *This class was deprecated in API level 13. Use the new `https://developer.android.com/reference/android/app/Fragment` and `https://developer.android.com/reference/android/app/FragmentManager` APIs instead; these are also available on older platforms through the Android compatibility package.* [AlertDialog](https://developer.android.com/reference/android/app/AlertDialog) A subclass of Dialog that can display one, two or three buttons. [AliasActivity](https://developer.android.com/reference/android/app/AliasActivity) *This class was deprecated in API level 30. Use `<activity-alias>` or subclass Activity directly.* [CharacterPickerDialog](https://developer.android.com/reference/android/text/method/CharacterPickerDialog) Dialog for choosing accented characters related to a base character. [DatePickerDialog](https://developer.android.com/reference/android/app/DatePickerDialog) A simple dialog containing an `https://developer.android.com/reference/android/widget/DatePicker`. [Dialog](https://developer.android.com/reference/android/app/Dialog) Base class for Dialogs. [DialogFragment](https://developer.android.com/reference/android/app/DialogFragment) *This class was deprecated in API level 28. Use the [Support Library](https://developer.android.com/tools/extras/support-library) `https://developer.android.com/reference/androidx/fragment/app/DialogFragment.html` for consistent behavior across all devices and access to [Lifecycle](https://developer.android.com/topic/libraries/architecture/lifecycle).* [ExpandableListActivity](https://developer.android.com/reference/android/app/ExpandableListActivity) *This class was deprecated in API level 30. Use `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.html` or use `https://developer.android.com/reference/android/widget/ExpandableListView` directly* [Fragment](https://developer.android.com/reference/android/app/Fragment) *This class was deprecated in API level 28. Use the [Jetpack Fragment Library](https://developer.android.com/jetpack) `https://developer.android.com/reference/androidx/fragment/app/Fragment.html` for consistent behavior across all devices and access to [Lifecycle](https://developer.android.com/topic/libraries/architecture/lifecycle).* [LauncherActivity](https://developer.android.com/reference/android/app/LauncherActivity) *This class was deprecated in API level 30. Applications can implement this UI themselves using `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.html` and `https://developer.android.com/reference/android/content/pm/PackageManager#queryIntentActivities(android.content.Intent,%20int)`* [ListActivity](https://developer.android.com/reference/android/app/ListActivity) *This class was deprecated in API level 30. Use `https://developer.android.com/reference/androidx/fragment/app/ListFragment.html` or `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.html` to implement your Activity instead.* [ListFragment](https://developer.android.com/reference/android/app/ListFragment) *This class was deprecated in API level 28. Use the [Support Library](https://developer.android.com/tools/extras/support-library) `https://developer.android.com/reference/androidx/fragment/app/ListFragment.html` for consistent behavior across all devices and access to [Lifecycle](https://developer.android.com/topic/libraries/architecture/lifecycle).* [NativeActivity](https://developer.android.com/reference/android/app/NativeActivity) Convenience for implementing an activity that will be implemented purely in native code. [PreferenceActivity](https://developer.android.com/reference/android/preference/PreferenceActivity) *This class was deprecated in API level 29. Use the [AndroidX](https://developer.android.com/jetpack/androidx) [Preference Library](https://developer.android.com/reference/androidx/preference/package-summary) for consistent behavior across all devices. For more information on using the AndroidX Preference Library see [Settings](https://developer.android.com/guide/topics/ui/settings).* [PreferenceFragment](https://developer.android.com/reference/android/preference/PreferenceFragment) *This class was deprecated in API level 28. Use the [AndroidX](https://developer.android.com/jetpack/androidx) [Preference Library](https://developer.android.com/reference/androidx/preference/package-summary) for consistent behavior across all devices. For more information on using the AndroidX Preference Library see [Settings](https://developer.android.com/guide/topics/ui/settings).* [Presentation](https://developer.android.com/reference/android/app/Presentation) Base class for presentations. [ProgressDialog](https://developer.android.com/reference/android/app/ProgressDialog) *This class was deprecated in API level 26. `ProgressDialog` is a modal dialog, which prevents the user from interacting with the app. Instead of using this class, you should use a progress indicator like `https://developer.android.com/reference/android/widget/ProgressBar`, which can be embedded in your app's UI. Alternatively, you can use a [notification](https://developer.android.com/guide/topics/ui/notifiers/notifications) to inform the user of the task's progress.* [TabActivity](https://developer.android.com/reference/android/app/TabActivity) *This class was deprecated in API level 13. New applications should use Fragments instead of this class; to continue to run on older devices, you can use the v4 support library which provides a version of the Fragment API that is compatible down to `https://developer.android.com/reference/android/os/Build.VERSION_CODES#DONUT`.* [TimePickerDialog](https://developer.android.com/reference/android/app/TimePickerDialog) A dialog that prompts the user for the time of day using a `https://developer.android.com/reference/android/widget/TimePicker`. [WebViewFragment](https://developer.android.com/reference/android/webkit/WebViewFragment) *This class was deprecated in API level 28. Manually call `https://developer.android.com/reference/android/webkit/WebView#onPause()` and `https://developer.android.com/reference/android/webkit/WebView#onResume()`*   

*** ** * ** ***

Interface definition for a callback to be invoked when the context menu for this view is being built.

## Summary

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/view/View.OnCreateContextMenuListener#onCreateContextMenu(android.view.ContextMenu,%20android.view.View,%20android.view.ContextMenu.ContextMenuInfo)(https://developer.android.com/reference/android/view/ContextMenu menu, https://developer.android.com/reference/android/view/View v, https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo menuInfo) ` Called when the context menu for this view is being built. |

## Public methods

### onCreateContextMenu

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onCreateContextMenu (ContextMenu menu, 
                View v, 
                ContextMenu.ContextMenuInfo menuInfo)
```

Called when the context menu for this view is being built. It is not safe to hold onto the menu after this method returns.

<br />

| Parameters ||
|---|---|
| `menu` | `ContextMenu`: The context menu that is being built <br /> |
| `v` | `View`: The view for which the context menu is being built <br /> |
| `menuInfo` | `ContextMenu.ContextMenuInfo`: Extra information about the item for which the context menu should be shown. This information will vary depending on the class of v. <br /> |