Intent In Android

What is Intent?

A messaging object which is used to communicate between different components is called Intent. Intent are the object which is utilized in android for passing the data among Activities in an Application and starting with one application then onto the next.

Example:

Intent intent  =  new  Intent(getApplicationContext(), SecondActivity.class);

StartActivity(intent);

Type of Intent:

Explicit Intent:

Communicates between two activities inside the same application. In Explicit we utilize the name of part which will be influenced by Intent. For Example: If we realize class name then we can explore the application starting with One Activity then onto the next action utilizing Intent. In the comparable manner we can begin a help to download a record in foundation measure.

Syntax:

Intent intent = new Intent(getApplicationContext(), SecondActivity.class);

startActivity(intent);

Implicit Intent

Communicates between two activities of different application. In Implicit Intents we do have to determine the name of the segment. We simply determine the Action which must be performed and further this activity is taken care of by the part of another application.

Syntax:

Intent intent = new Intent(Intent.ACTION_VIEW);

intent.setData(Uri.parse(“https://developer.android.com”));

startActivity(intent);

Conclusion:

In this blog, we found out about Intents in Android. Subsequent to perusing this blog, I figure you will actually want to call movement with the assistance of Intents. Likewise, we found out about Implicit and Explicit Intents.

Leave a Comment

Your email address will not be published. Required fields are marked *