i want to make a calculator whose calculation is done on second page and displayed on third page values are taken from first page : //This is mainactivity.java

package com.example.bhask.myapplication;


import android.content.Intent;

import android.support.v7.app.AppCompatActivity;

import android.os.Bundle;

import android.view.View;

import android.widget.Button;

import android.widget.EditText;

public class MainActivity extends AppCompatActivity {

    EditText et1,et2;

    Button btn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        et1=(EditText)findViewById(R.id.et1);

        et2=(EditText)findViewById(R.id.et2);

        btn=(Button)findViewById(R.id.btn);

        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                String v1=et1.getText().toString();

                String v2=et2.getText().toString();

                int val1=Integer.parseInt(v1);

                int val2=Integer.parseInt(v2);

                int sum =val1+val2;






                Intent i=new Intent(MainActivity.this,Main2Activity.class);

                i.putExtra("val1","Num1 is"+val1);
                i.putExtra("val2","Num2 is: "+val2);


                startActivity(i);



            }
        });
    }
}

//This is main2.activty.java

package com.example.bhask.myapplication;

import android.content.Intent;

import android.support.v7.app.AppCompatActivity;

import android.os.Bundle;

import android.view.View;

import android.widget.Button;

public class Main2Activity extends AppCompatActivity {

    Button btn1,btn2,btn3,btn4;
    static int ans;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

        btn1=(Button)findViewById(R.id.btn1);


        Intent i=getIntent();
        final int val1 = i.getIntExtra("val1",0);
        final int val2 = i.getIntExtra("val2",0);

        btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {


                int ans=val1+val2;


                Intent i1=new Intent(Main2Activity.this,Main3Activity.class);
                i1.putExtra("ans","Add is "+ans);

               startActivity(i1);

               finish();

            }
        });


    }
}

//This is main3activity.java

package com.example.bhask.myapplication;

import android.content.Intent;

import android.support.v7.app.AppCompatActivity;

import android.os.Bundle;

import android.widget.TextView;

import android.widget.Toast;

public class Main3Activity extends AppCompatActivity {

    TextView tv;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main3);

        Toast.makeText(getApplicationContext(),"Here",Toast.LENGTH_LONG).show();

        tv=(TextView)findViewById(R.id.tv);

        Intent i2=getIntent();

        String data=i2.getStringExtra("ans");

        tv.setText(data);
    }
}