【小王的安卓之路】Android安卓入门之Intent(意图)及其功能解析

Intent-意图

  • 1.Intent是什么?
  • 2.Intent是干什么用的?
  • 3.Intent使用方法
  • 4.Intent过滤器

一.Intent是什么?

官方文档是这样说的:

An intent is an abstract description of an operation to be performed. It can be used with startActivity to launch an Activity, broadcastIntent to send it to any interested BroadcastReceiver components, and startService(Intent) or bindService(Intent, ServiceConnection, int) to communicate with a background Service.
An Intent provides a facility for performing late runtime binding between the code in different applications. Its most significant use is in the launching of activities, where it can be thought of as the glue between activities. It is basically a passive data structure holding an abstract description of an action to be performed.

乌拉乌拉。。。。。。。一大堆,说的简单点,Intent的核心思想就是传递信息!那它到底是传递什么信息,给谁传递信息呢?

且往下看

二.Intent是干什么用的?

Intent是一个消息传递对象,你可以使用它从其他应用组件请求操作。尽管 Intent 可以通过多种方式促进组件之间的通信,但其基本用例主要包括以下三个:

启动 Activity:(上篇文章中有提到)
Activity 表示应用中的一个屏幕。通过将 Intent 传递给 startActivity(),您可以启动新的 Activity 实例。Intent 描述了要启动的 Activity,并携带了任何必要的数据。

如果你希望在 Activity 完成后收到结果,就调用 startActivityForResult()。在 Activity 的 onAc

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值