android - Activity中通过Fragment的对象调用其方法时,无法将数据设置进入Fragment
怪我咯
怪我咯 2017-04-17 16:03:42
0
2
502
怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
大家讲道理
  1. Activity can directly reference Fragment.

  2. Your calling method can change the member variables of Fragment. A better way is to write an interface Activity to communicate with Fragment

  3. 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.

  4. It is recommended to post more code to check the problem.

伊谢尔伦

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template