How to get back to the front of the activity activity data?

Between two activity data transfer with a lot of paper in the jump, with the putExtras data compression in, can be received in the new activity onCreate, most of the data is that.

I need a little not the same place, in the jump to the new activity, the original activity was still there, returned to the old activity in the new activity finish, from the onResume function to see the back, no need to complete through the jump, so the question is, how the new activity to the old activity data transfer it?

Started by Bowen at February 10, 2016 - 3:54 AM

In simple terms, a activity before destruction, pass the data to the last activity, but this is the last activity exactly is who? It is not know.

Posted by Bowen at February 22, 2016 - 4:10 AM

How can say not to know the last Activity who is who. A move to open a new Activity startActivity is certainly in the old Activity (Intent in)? If you want to pass values to the front of the Activity. You can use the startActivityForResult () this method opens a new Activity. Of course, if you really like you said, do not know who is the last Activity. You can try to use the broadcast mode.

Posted by Lucy at March 04, 2016 - 4:33 AM

The new activity writes data file, the old activity read from the file

Posted by Cheryl at March 10, 2016 - 4:55 AM

You can't say startActivityForResult

Posted by Beatrix at March 15, 2016 - 4:57 AM

Using application to share data, the specific code online

Posted by Frederic at March 28, 2016 - 5:37 AM

StartActivityForResult is very convenient

Posted by Tamara at March 30, 2016 - 6:36 AM

My new activity is a select a file in the file list, select the file after the notice of a class, whether a class is what activity.

Posted by Bowen at April 08, 2016 - 6:41 AM

The landlord, the use of startActivityForResult (activity) to start a new, reliable and convenient, when the new finish off, the data into intent, setResult (int resultCode, Intent data), then rewrite in the old activity onActivityResult method:
    @Override
protected void onActivityResult(int requestCode, int resultCode, Intent result) {
if (resultCode != RESULT_OK) {
finish();
return;
}
}

The inside of the result is set in the new activity data transfer.

Posted by Payne at April 09, 2016 - 6:42 AM

Your file list is launched in which Activity. He should be a list of files on a Activity.

Posted by Lucy at April 21, 2016 - 6:52 AM

This research.!

Posted by Bowen at April 24, 2016 - 7:50 AM

This help

Posted by Reg at April 25, 2016 - 7:52 AM

This method or using application shared data

Posted by Clement at December 05, 2016 - 11:01 PM

The use of data sharing, file, SQLITE can ah

Posted by Christopher at December 12, 2016 - 11:44 PM

Very useful. Are learning Android.

Posted by Selina at December 15, 2016 - 11:53 PM

Positive solutions of startActivityForResult

Posted by Alva at December 19, 2016 - 12:48 AM

A:

Intent intent = new Intent();
intent.setClass(B.class);
startActivityForResult(intent,request_code);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent result) {
if (resultCode != RESULT_OK) {
String a = result.getStringExtra(key);
}
}

B:
Intent intent = new Intent();
intent.putStringExtra(key,value);
setResult(RESULT_OK,intent);
finish();

Posted by Alva at January 02, 2017 - 1:30 AM

Broadcasting can indeed solve value transfer, but can not or can not.

Posted by Rex at January 08, 2017 - 2:37 AM

if (resultCode != RESULT_OK) {
String a = result.getStringExtra(key);
}

Corrections

if (resultCode == RESULT_OK) {
String a = result.getStringExtra(key);
}

Posted by Alva at January 09, 2017 - 3:33 AM

Yeah, like cold antibiotics abuse of broadcasting.

Posted by Bowen at January 11, 2017 - 2:10 AM