Android PassData Between Activities

Example:

                                    
                                        // activity_pass_data_between_activities_example.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".PassDataBetweenActivitiesExample"
        android:gravity="center"
        android:orientation="vertical"
        android:background="@color/colorOrange">
   
       <FrameLayout
           android:id="@+id/pasFrame"
           android:layout_width="match_parent"
           android:layout_height="match_parent">
   
           <LinearLayout
               android:id="@+id/passlin"
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:orientation="vertical"
               android:padding="16dp"
               android:layout_gravity="center"
               android:gravity="center">
   
               <TextView
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
                   android:text="Fill Below Details"
                   android:textColor="@color/colorWhite"
                   android:textSize="37dp"
                   android:gravity="center"/>
   
               <EditText
                   android:id="@+id/name"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
                   android:hint="Enter your name"
                   android:layout_marginTop="16dp"/>
   
               <EditText
                   android:id="@+id/age"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
                   android:layout_marginTop="16dp"
                   android:hint="Enter your age"/>
   
               <Button
                   android:id="@+id/submit1"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:text="Submit"
                   android:textColor="@color/colorWhite"
                   android:layout_gravity="center"
                   android:layout_marginTop="25dp"
                   android:background="@color/colorAccent"/>
   
            </LinearLayout>
   
        </FrameLayout>
   
</LinearLayout>


// activity_two.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".ActivityTwo"
        android:gravity="center"
        android:padding="16dp"
        android:orientation="vertical"
        android:background="@color/colorPrimaryDark">
   
       <FrameLayout
           android:id="@+id/pasFrame"
           android:layout_width="match_parent"
           android:layout_height="match_parent">
   
           <LinearLayout
               android:id="@+id/passlin"
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:orientation="vertical"
               android:padding="16dp"
               android:layout_gravity="center"
               android:gravity="center">
   
               <TextView
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
                   android:text="This is the Second Activity"
                   android:textColor="@color/colorWhite"
                   android:textSize="30dp"
                   android:gravity="center"
                   android:layout_marginBottom="50dp"/>
   
               <TextView
                   android:id="@+id/text_view1"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
                   android:text=""
                   android:textColor="@color/colorWhite"
                   android:textSize="30dp"
                   android:gravity="center"/>
   
               <TextView
                   android:id="@+id/text_view2"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
                   android:text=""
                   android:textColor="@color/colorWhite"
                   android:textSize="30dp"
                   android:gravity="center"/>
   
               <Button
                   android:id="@+id/back"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:text="Back"
                   android:textColor="@color/colorWhite"
                   android:gravity="center"
                   android:background="@color/colorOrange"
                   android:layout_marginTop="30dp"/>
   
            </LinearLayout>
    
        </FrameLayout>
   
</LinearLayout>
                                    
                                  

Output