简体   繁体   中英

Android - add date from one fragment to another running fragment

I have 2 Fragments, A and B

A is already running and has edittexts and data filled out.

There is a button in A that opens fragment B

fragment B is a list of pictures

I need to select a picture from B and send it back to A where it is set as an imageview.

how do I do this with out loosing all the data already filled out in A.

尝试Fragment.setTargetFragment和Fragment.getTargetFragment

Use onSaveInstanceState http://developer.android.com/reference/android/app/Fragment.html#onSaveInstanceState(android.os.Bundle)

Check out this thread if you're still having problems saving the states in fragments. Fragment's onSaveInstanceState() is never called

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM