How To Pass A value From First Activity to Second Activity

Suppose we have to input a value through UI and pass that to another activity,we use 'Bundle'




---------------------------First Activity -------------------------------------
//Phone  number is  the input stored variable

String code = phonecode.getText().toString();
                        Bundle bundle = new Bundle();
                        bundle.putString("Ph_code", code);
                        Intent intent = new Intent(PatrolliveActivity.this,
                                login.class);


// we use 'putExtras'-----------


                        intent.putExtras(bundle);
                        startActivityForResult(intent, 0);

------------------------------------------------------------------------------------------------------------------

//-----------------------Second Activity---------------

//----We use 'getExtras' to get that value in second activity----



Bundle bundle = this.getIntent().getExtras();
        String phonecode = bundle.getString("Ph_code");