What's the point of setArguments?

前端 未结 4 1641
忘了有多久
忘了有多久 2020-12-13 03:55

Hi I was looking at the following Fragments example on the android site.

http://developer.android.com/guide/components/fragments.html#Example

I would like to

4条回答
  •  感情败类
    2020-12-13 04:31

    In addition setters can be misused. If updateSomeOtherStuff() will change some view this will crash.

    public class MyFragment extends Fragment {
       void setData(someData){
           this.someData = someData;
           updateSomeOtherStuff()
       }
    }
    

    If one passing in a bundle it is not possible to misuse the setter and you will always know that this will be set within the lifecycle methods.

提交回复
热议问题