zoukankan      html  css  js  c++  java
  • Android开发ABC之:Context

    SDK Doc中对Context的定义如下:

    Interface to global information about an application environment. This is an abstract class whose implementation is provided by the Android system. It allows access to application-specific resources and classes, as well as up-calls for application-level operations such as launching activities, broadcasting and receiving intents, etc

    看代码,可以知道Context是一个抽象类,Android系统提供的实现是ContextImpl,它提供了对应用所执行的环境操作的功能,Context提供的功能包括:

    • Start/Stop Service
    • bind/unbind Service
    • register/unregister Receiver
    • start intentsender
    • start instrumentation
    • start Activity
    • Open/Create database
    • open file
    • . . . . .

    ContextHierarchy

    从这个类图关系,我们可以看出,没创建一个Activity、Service或者Application都会创建一个ContextImpl对象,但是多个ContextImpl中大部分操作都是由一个PackageInfo对象完成,也就是说不论创建多少Context,最后执行操作的都是一个PackageInfo对象。

  • 相关阅读:
    windows权限维持
    pocsuite3检测工具 编写poc
    php异或免杀
    python 多线程ftp爆破
    python ip查询 whois查询 # CDN查询# 子域名查询# 端口扫描
    python src批量爬取
    qykcms 审计
    dedecms审计
    EasySNS 审计
    zzcms审计
  • 原文地址:https://www.cnblogs.com/whyandinside/p/2905028.html
Copyright © 2011-2022 走看看