Q:

how to send a particular text on click of particular layout from one activity to another

If I select easy layout then the textview in secoundactivity should display "EASY" and if I select normal layout then textview in secoundactivity should display "NORMAL" on it.there is only one textview in secoundactivity and it should display the text as per the click on layout
i.e send a particular text on click of particular layout from one activity to another

Mainactivity.xml
[<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

 <LinearLayout
        android:id="@+id/layouteasy"
        android:layout_width="match_parent"
        android:layout_height="110dp"
        android:background="#456636"
        android:clickable="true"
        android:onClick="easy"
        android:orientation="horizontal">

<TextView
            android:id="@+id/easytext"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="EASY"
            android:textAlignment="center"
            android:textColor="#ffb9b9"
            android:textSize="20sp"
            android:textStyle="bold" />
    </LinearLayout>

<LinearLayout
        android:id="@+id/layoutnormal"
        android:layout_width="match_parent"
        android:layout_height="110dp"
        android:background="#334556"
        android:clickable="true"
        android:onClick="normal"
        android:orientation="horizontal">

 <TextView
            android:id="@+id/normaltext"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="NORMAL"
            android:textAlignment="center"
            android:textColor="#6afa73"
            android:textSize="20sp"
            android:textStyle="bold" />
    </LinearLayout>
</LinearLayout>]

A:

//In the first activity
//for easy textview
public void easy(View v){
String text=((TextView)v).getText().toString();
Intent i=new Intent(this, SecondActivity.class);
i.putExtra("Text",text);
startActivity(i);
}

//for Normal textview
public void Normal(View v){
String text=((TextView)v).getText().toString();
Intent i=new Intent(this, SecondActivity.class);
i.putExtra("Text",text);
startActivity(i);
}

//in the second activity main class get the text using the code
String s = getIntent().getStringExtra("Text");
//to set text in second activity
TextView myTextView=findViewById(R.id.textview_id);
myTextView.setText(s);

Refer to this for more info on intents.

