Context and Activity

本文详细介绍了Android中的Context类及其继承体系,包括多个直接和间接子类如Activity、Service等,并解释了它们之间的关系。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

经常看到一些类中用到的context,从继承关系来看,activity就可以用。

public abstract class
Context
extends Object

java.lang.Object
   ↳android.content.Context
Known Direct Subclasses

Known Indirect Subclasses

AbstractInputMethodServiceAbstractInputMethodService provides a abstract base class for input methods.
AccessibilityServiceAn accessibility service runs in the background and receives callbacks by the system when AccessibilityEvents are fired.
AccountAuthenticatorActivityBase class for implementing an Activity that is used to help implement an AbstractAccountAuthenticator.
ActivityAn activity is a single, focused thing that the user can do.
ActivityGroupThis class is deprecated. Use the new Fragment and FragmentManager APIs instead; these are also available on older platforms through the Android compatibility package. 
AliasActivityStub activity that launches another activity (and then finishes itself) based on information in its component’s manifest meta-data.
ApplicationBase class for those who need to maintain global application state.
BackupAgentProvides the central interface between an application and Android’s data backup infrastructure.
BackupAgentHelperA convenient BackupAgent wrapper class that automatically manages heterogeneous data sets within the backup data, each identified by a unique key prefix.
ContextThemeWrapperA ContextWrapper that allows you to modify the theme from what is in the wrapped context.
ExpandableListActivityAn activity that displays an expandable list of items by binding to a data source implementing the ExpandableListAdapter, and exposes event handlers when the user selects an item.
FragmentActivityBase class for activities that want to use the support-based Fragment and Loader APIs.
InputMethodServiceInputMethodService provides a standard implementation of an InputMethod, which final implementations can derive from and customize.
IntentServiceIntentService is a base class for Services that handle asynchronous requests (expressed as Intents) on demand.
IsolatedContextA mock context which prevents its users from talking to the rest of the device while stubbing enough methods to satify code that tries to talk to other packages.
LauncherActivityDisplays a list of all activities which can be performed for a given intent.
ListActivityAn activity that displays a list of items by binding to a data source such as an array or Cursor, and exposes event handlers when the user selects an item.
MockApplicationA mock Application class.
MutableContextWrapperSpecial version of ContextWrapper that allows the base context to be modified after it is initially set.
NativeActivityConvenience for implementing an activity that will be implemented purely in native code.
PreferenceActivityThis is the base class for an activity to show a hierarchy of preferences to the user.
RecognitionServiceThis class provides a base class for recognition service implementations.
RemoteViewsServiceThe service to be connected to for a remote adapter to request RemoteViews.
RenamingDelegatingContextThis is a class which delegates to the given context, but performs database and file operations with a renamed database/file name (prefixes default names with a given prefix).
ServiceA Service is an application component representing either an application’s desire to perform a longer-running operation while not interacting with the user or to supply functionality for other applications to use.
SpellCheckerServiceSpellCheckerService provides an abstract base class for a spell checker.
TabActivityThis class is deprecated. 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 DONUT
TextToSpeechServiceAbstract base class for TTS engine implementations.
VpnServiceVpnService is a base class for applications to extend and build their own VPN solutions.
WallpaperServiceA wallpaper service is responsible for showing a live wallpaper behind applications that would like to sit on top of it.

public class

Activity

extends ContextThemeWrapper
implements ComponentCallbacks2 KeyEvent.Callback LayoutInflater.Factory2 View.OnCreateContextMenuListener Window.Callback


 Posted by ian at 00:13  Tagged with: Android
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值