Get Value of different field in fragment from the parent Activity

前端 未结 4 753
借酒劲吻你
借酒劲吻你 2021-01-25 06:22

I\'ve an addActivity hosting 5 fragments, on each fragments I\'ve some fields to fill.
I want to get the value of those fields from the addActivity

4条回答
  •  臣服心动
    2021-01-25 06:45

    You could try to add a text changed listener to your edit text fields on each fragment and make a String field you set equal to the value of the edittext view when ever a user changes the text. Then save each instance of the fragment in your FragPagerAdapter and create a public method that will return all of the strings from each individual fragment in an array or how ever you want. Call that method from the Activity.

提交回复
热议问题