Communicate between activity in Android Studio  

Intents are the objects of android.content.Intent type. It can contain data via a Bundle. This data can be used by the receiving component.startActivity() method you can define that the intent should be used to start.

0 328 Technology | Android App
Tue Nov 13 , 2018

Step 1 : Create a new project name it IntentExample

Step 2 : Select Empty Activity

Step 3 : Inside main_activity.xml Add Button

Copy and paste code

  android:text="Click Here"

Step 4 : Now go to

Copy and paste code

Button btn; //make object of Button Class before oncreate method
btn=findViewById(; //find the btnclick id

//Add Button Click Event

btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
intent = new Intent(MainActivity.this,NextActivity.class);

//Intent is used to redirect from one activity to another activity
//we have to make a object of Intent class and pass the current activity name and the redirect activity name


//after that startactivity and pass the object of the Intent class

Step 5 : Now Add a new Activity and name it NextActivity

Build the project


Subscribe & Get Regular Updates On Your E-mail