What is 'Context' on Android?

前端 未结 30 3026
南旧
南旧 2020-11-21 04:46

In Android programming, what exactly is a Context class and what is it used for?

I read about it on the developer site, but I am unable to understand it

30条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-21 05:30

    The Context is the android specific api to each app-s Sandbox that provides access app private data like to resources, database, private filedirectories, preferences, settings ...

    Most of the privatedata are the same for all activities/services/broadcastlisteners of one application.

    Since Application, Activity, Service implement the Context interface they can be used where an api call needs a Context parameter

提交回复
热议问题