[英]How to pass date from one fragment to another in the same activity in Android?
[英]Android - add date from one fragment to another running fragment
我有2個片段,A和B
A已在運行,並且已填充了edittext和數據。
A中有一個按鈕可以打開片段B
片段B是圖片列表
我需要從B中選擇一張圖片,然后將其發送回A並在其中設置為imageview。
如何在不丟失A中已經填寫的所有數據的情況下做到這一點。
嘗試Fragment.setTargetFragment和Fragment.getTargetFragment
使用onSaveInstanceState http://developer.android.com/reference/android/app/Fragment.html#onSaveInstanceState(android.os.Bundle)
如果您仍然無法將狀態保存在片段中,請查看此線程。 片段的onSaveInstanceState()永遠不會被調用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.