Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the difference between intent extra and intent data?

I see any intent has extra field and a data field.

is there any difference between them or it's just a conceptual difference?

like image 723
Elad Benda Avatar asked Jan 23 '14 08:01

Elad Benda


People also ask

What does intent put extra do?

The Android Intent class is commonly used to move from one activity to another. The Intent class has a method named putExtra() that you can use to put extended data to the intent. The main use of the putExtra() method is to send values you need in the next activity.

What is the difference between intent and bundle?

Bundles are used with intent and values are sent and retrieved in the same fashion, as it is done in the case of Intent. It depends on the user what type of values the user wants to pass, but bundles can hold all types of values (int, String, boolean, char) and pass them to the new activity.

What is extra in Android Studio?

Using putExtra() and getExtras() in android Intents are asynchronous messages which allow Android components to request functionality from other components of the Android system. For example an Activity can send an Intents to the Android system which starts another Activity .

How can I get intent data from another activity?

For this, Intent will start and the following methods will run: putExtra() method is used for sending the data, data in key-value pair key is variable name and value can be Int, String, Float, etc. getStringExtra() method is for getting the data(key) that is sent by the above method.


1 Answers

Data

The URI (a Uri object) that references the data to be acted on and/or the MIME type of that data. The type of data supplied is generally dictated by the intent's action. For example, if the action is ACTION_EDIT, the data should contain the URI of the document to edit.

Data return URI

Extras

Key-value pairs that carry additional information required to accomplish the requested action. Just as some actions use particular kinds of data URIs, some actions also use particular extras.

Extras contains a Bundle which is an implementation of HashMap to store key values of specific data .

Extra Return Bundle

For more information About Intent extra And Data refer this Url

like image 70
Govinda Rajbhar Avatar answered Sep 28 '22 03:09

Govinda Rajbhar