mars

Intent

 

Intent

An Intent is a messaging object you can use to request an action from another app component. You can use the Intent component to start a new acitivity or pass data to another activity.

Example

Set of blocks to start another activity while passing the data of someValue with key someKey.

example



Blocks

setData

Used to point to the location of a data object (like a file for example), while putExtra adds simple data types (such as an SMS text string for example).

set data

TYPEEXPLANATIONREQUIRED
IntentIntent ComponentYes
StringData to transfer to next activity. Read more here.No

setScreen

Sets the screen to navigate to.

set screen

TYPEEXPLANATIONREQUIRED
IntentIntent ComponentYes
ActivityActivity to navigate toYes

putExtra

Pass data to another Activity. After you pass the data, you retrieve the data using the Activity getExtra key [] block.

put extra

TYPEEXPLANATIONREQUIRED
IntentIntent ComponentYes
StringKey value used to retrieve laterYes
StringValue to passYes

setFlags

Change the behavior of an activity.

  1. SINGLE_TOP — Organizes the views in a way that if the view you’re about to transition to was already called before, it would bring that view to the top rather than putting another copy on the top.

  2. CLEAR_TOP - Clears all the previous views.

set flags

TYPEEXPLANATIONREQUIRED
IntentIntent ComponentYes
FlagFlag to setYes

startActivity

Start a new activity.

start activity

TYPEEXPLANATIONREQUIRED
IntentIntent ComponentYes

Post a Comment

0 Comments