i am creating a simple application that contain 3 buttons where each button have its listener that take the user input and do some math calculation than it display the result in toast .
but the third button display the result in second activity using intent .
the first buton work as it should but the second and third do not work . mean that the second do not show a toast and third do not display the result in the second activity .
can anyone help me ???
MainActivity.java
package com.tipcalc.assignment1;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends Activity implements OnClickListener {
    EditText txt;
    Button btn1, btn2, btn3;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        txt = (EditText) findViewById(R.id.edittxt);
        btn1 = (Button) findViewById(R.id.button1);
        btn2 = (Button) findViewById(R.id.button2);
        btn3 = (Button) findViewById(R.id.button3);
        btn1.setOnClickListener(this);
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        String input;
        String result = null;
        Double dbl;
        if (arg0 == btn1) {
            input = txt.getText().toString();
            dbl = Double.parseDouble(input) * 0.1;
            result = String.valueOf(dbl);
        } else if (arg0 == btn2) {
            input = txt.getText().toString();
            dbl = Double.parseDouble(input) * 0.15;
            result = String.valueOf(dbl);
        }
            Toast.makeText(this, result, Toast.LENGTH_LONG).show();
        if(arg0 == btn3){
            Intent intent = new Intent(MainActivity.this, SecondPage.class);
            intent.putExtra("com.tipcalc.assignment1.showResult", result);
            startActivity(intent);
        }
    }
}
SecondActivity.java
package com.tipcalc.assignment1;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
public class SecondPage extends Activity {
    TextView txt_result;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second_page);
        txt_result = (TextView) findViewById(R.id.txtResult);
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            String value = extras
                    .getString("com.tipcalc.assignment1.showResult");
            txt_result.setText(value);
        }
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.second_page, menu);
        return true;
    }
}
 
    