private final int SECONDARY_ACTIVITY_REQUEST_CODE=0;

  //create a new intent and specify that it's target is SecondaryActivity...
            Intent intent = new Intent(getApplicationContext(),newpage.class);
            //load the intent with a key "myKey" and assign it's value
            //to be whatever has been entered into the text field...
            intent.putExtra("title","xxx");
            //launch the secondary activity and send the intent along with it
            //note that a request code is passed in as well so that when the 
            //secondary activity returns control to this activity, 
            //we can identify the source of the request...
            startActivityForResult(intent, SECONDARY_ACTIVITY_REQUEST_CODE);



     @Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent){
super.onActivityResult(requestCode, resultCode, intent);
Bundle extras = intent.getExtras();
        String t1=extras.getString("returnKey"):

     }

newpage.class

     Intent intent=this.getIntent();
        Bundle bunde = intent.getExtras();
        String t_appslink_url=bunde.getString("title");

….. do something…..return…..to fish page..

 Intent intent = new Intent();
                //add "returnKey" as a key and assign it the value
                //in the textbox...
                intent.putExtra("returnKey","finish");
                //get ready to send the result back to the caller (MainActivity)
                //and put our intent into it (RESULT_OK will tell the caller that 
                //we have successfully accomplished our task..
                setResult(RESULT_OK,intent);
                //close this Activity...
                finish();

By admin-powenko

Dr. Powen Ko is a teacher and CEO on LoopTek LLC, and like to teaching. if you need to class, please let PowenKo know, he will love to service and sharing. LoopTek web site is www.looptek.com

Leave a Reply