What is Intents in Android SDK?

Intents in Android SDK are a fundamental concept used for communication between components in an Android application. Intents allow you to start activities, send broadcasts, and communicate with services. They serve as a messaging object that can carry data between different parts of your app or even between different apps. There are two types of intents: explicit intents, which explicitly specify the component to start, and implicit intents, which declare a general action to perform, allowing the system to find the appropriate component to handle it.

Example of Intents

// Creating an explicit intent to start another activity Intent intent = new Intent(CurrentActivity.this, TargetActivity.class); startActivity(intent); // Creating an implicit intent to open a web page Intent webIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.example.com")); startActivity(webIntent);

Intents Android SDK explicit intents implicit intents Android communication