Android中的活动,上下文和意图是什么? [英] What is an activity, a context and an intent in Android?

查看:134
本文介绍了Android中的活动,上下文和意图是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我什么是Android中的活动,上下文和意图吗?

Can somebody please explain to me what an activity, a context and an intent in Android are?

我阅读了Android文档,但我听不懂这些概念.

I read the Android documentation, but I could not understand these concepts.

推荐答案

活动:表示Android应用程序的表示层,例如用户看到的屏幕.一个Android应用程序可以有多个活动,并且可以在应用程序运行时在它们之间进行切换.

Activity: represents the presentation layer of an Android application, e.g. a screen which the user sees. An Android application can have several activities and it can be switched between them during runtime of the application.

ContentProvider :向应用程序提供数据,您可以通过内容提供商将应用程序与其他应用程序共享数据. Android包含SQLite数据库,可以用作数据提供程序

ContentProvider: provides data to applications, via a content provider your application can share data with other applications. Android contains a SQLite DB which can serve as the data provider

意图-是异步消息,允许应用程序从其他服务或活动中请求功能.应用程序可以直接调用服务或活动(显式意图),也可以向Android系统询问注册服务和应用程序的意图(隐式意图).例如,该应用程序可以通过意图请求联系人应用程序.应用程序通过IntentFilter将自己注册到意图. 意图是一个强大的概念,因为它们允许创建松耦合的应用程序.

Intents - are asynchronous messages which allow the application to request functionality from other services or activities. An application can call directly a service or activity (explicit intent) or ask the Android system for registered services and applications for an intent (implicit intents). For example, the application could ask via an intent for a contact application. Applications register themselves to an intent via an IntentFilter. Intents are a powerful concept as they allow the creation of loosely coupled applications.

请参阅以下链接: http://www.vogella.de/articles/Android/article.html .

这篇关于Android中的活动,上下文和意图是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆