
Intents allow you to interact with components of the same application as well as the components that contributed by other applications.
For instance, an activity can begin external activity to photograph Image.
An Intent can contain data through Bundle. This data can be used by the receiving component.
For example: Intent allows you to divert your activity to another activity on any incident. By calling, startActivity () You can perform this task.
Intent intent = new
Intent(getApplicationContext(), SecondActivity.class);
startActivity(intent);
In the above example, the foreground activity increasingly directed to other activities SecondActivity.java.getApplicationContext ()
returns the context for your foreground activity.
Type of Intent

1.Explisit:
Interest explicitly used to connect applications internal.Secara we explicitly use the name components that will be affected by intention.
For example:
If we know the name of the class then we can navigate the application of OneActivity to another activity using Intent.
Intent intent = new Intent(getApplicationContext(), SecondActivity.class);
startActivity(intent);
2. Implicit:
With implicit intent, we need to specify the name of the component we only determine action to be taken and further action is handled by other application components.
Examples of basic intent is implicit open any web page
Intent intentObj = new Intent(Intent.ACTION_VIEW);
intentObj.setData(Uri.parse("http://www.AndroidSquad.Net"));
startActivity(intentObj);
examples of Intent
Step 1: Let’s Make UI Design at the Design activity_main.xml two buttons Explicit Intent and Intent implicated.
Step 2: Create a new activity named “Second Activity”.
Step 3: Write the code in MainActivity.java.
public class MainActivity extends AppCompatActivity {
Button explicit_btn, implicit_btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
explicit_btn = (Button)findViewById(R.id.explicit_Intent);
implicit_btn = (Button) findViewById(R.id.implicit_Intent);
explicit_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getBaseContext(), SecondActivity.class);
startActivity(intent);
}
});
implicit_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(“www.youtube.com/AndroidMasterApp"));
startActivity(intent);
}
}); }}
Explicit Intent Sample
1- Designing the User Interface, Create 2 Activity & Create a text like this.

2- In Activity Secondly, Create Text with a rating of 2 Bar.

3- Coding PutExtra (): This will transfer the value of inter-activity

4- Receive Data From First Activity:

Source: Master Android (App)