大家讲道理2017-04-17 16:05:42
Activity can directly reference Fragment.
Your calling method can change the member variables of Fragment. A better way is to write an interface Activity to communicate with Fragment
There are two possibilities for your log to be empty: one is that the Activity or Fragment has been recycled and re-created, and the previously changed attributes have not been restored. For related technical points, you can view Activity data recovery; the other is that you have changed and printed the log in two Fragments. citations.
It is recommended to post more code to check the problem.
伊谢尔伦2017-04-17 16:05:42
Too little sticky code. Based on this, it is suspected that the Activity has been rebuilt, or the fragment in the Activity has been rebuilt, but the newly created Activity or Fragment has not been executed using the setOptions
可以打印Fragment的构造函数和setOptions
function mentioned here to check